Disable network tests
authorXimin Luo <infinity0@debian.org>
Thu, 13 Jun 2024 09:16:38 +0000 (11:16 +0200)
committerFabian Grünbichler <debian@fabian.gruenbichler.email>
Wed, 4 Dec 2024 17:07:54 +0000 (18:07 +0100)
Forwarded: TODO

Gbp-Pq: Topic cargo
Gbp-Pq: Name c-2002_disable-net-tests.patch

src/tools/cargo/tests/testsuite/credential_process.rs
src/tools/cargo/tests/testsuite/git_auth.rs
src/tools/cargo/tests/testsuite/net_config.rs
src/tools/cargo/tests/testsuite/publish.rs

index 391cdb33b26363b77c3c019234b3321ac7ad0aaa..fcf1a6f1038d9d27bc21f836b999141c82849dcb 100644 (file)
@@ -65,7 +65,7 @@ fn get_token_test() -> (Project, TestRegistry) {
     (p, server)
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish() {
     // Checks that credential-process is used for `cargo publish`.
     let (p, _t) = get_token_test();
@@ -87,7 +87,7 @@ You may press ctrl-c [..]
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn basic_unsupported() {
     // Non-action commands don't support login/logout.
     let registry = registry::RegistryBuilder::new()
@@ -121,7 +121,7 @@ Caused by:
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn login() {
     let registry = registry::RegistryBuilder::new()
         .no_configure_token()
@@ -142,7 +142,7 @@ fn login() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn logout() {
     let server = registry::RegistryBuilder::new()
         .no_configure_token()
@@ -161,7 +161,7 @@ fn logout() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn yank() {
     let (p, _t) = get_token_test();
 
@@ -176,7 +176,7 @@ fn yank() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn owner() {
     let (p, _t) = get_token_test();
 
@@ -191,7 +191,7 @@ fn owner() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn invalid_token_output() {
     // Error when credential process does not output the expected format for a token.
     let cred_proj = project()
index 0e52e143de8eb7d076b5a8780d60a398edcdbd02..3e18360e0f644fc002dec0d172f3bf5ea27f5585 100644 (file)
@@ -105,7 +105,7 @@ fn setup_failed_auth_test() -> (SocketAddr, JoinHandle<()>, Arc<AtomicUsize>) {
 }
 
 // Tests that HTTP auth is offered from `credential.helper`.
-#[cargo_test]
+#[allow(dead_code)]
 fn http_auth_offered() {
     let (addr, t, connections) = setup_failed_auth_test();
     let p = project()
@@ -178,7 +178,7 @@ Caused by:
 }
 
 // Boy, sure would be nice to have a TLS implementation in rust!
-#[cargo_test]
+#[allow(dead_code)]
 fn https_something_happens() {
     let server = TcpListener::bind("127.0.0.1:0").unwrap();
     let addr = server.local_addr().unwrap();
index b765678c71b5691abc263f32801cfb6ffa11502f..ed695bd9485e2df0d987682a8fc36f65db1a2845 100644 (file)
@@ -4,7 +4,7 @@ use cargo_test_support::prelude::*;
 use cargo_test_support::project;
 use cargo_test_support::str;
 
-#[cargo_test]
+#[allow(dead_code)]
 fn net_retry_loads_from_config() {
     let p = project()
         .file(
@@ -41,7 +41,7 @@ fn net_retry_loads_from_config() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn net_retry_git_outputs_warning() {
     let p = project()
         .file(
index 777129657150c4fabe463b793d65761a3409068f..2f681d9c99c3f356ef23ed99f089a25bb25bf617 100644 (file)
@@ -90,7 +90,7 @@ fn validate_upload_li() {
     );
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn simple() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -182,7 +182,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
 
 // Check that the `token` key works at the root instead of under a
 // `[registry]` table.
-#[cargo_test]
+#[allow(dead_code)]
 fn simple_publish_with_http() {
     let _reg = registry::RegistryBuilder::new()
         .http_api()
@@ -222,7 +222,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn simple_publish_with_asymmetric() {
     let _reg = registry::RegistryBuilder::new()
         .http_api()
@@ -265,7 +265,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn old_token_location() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -324,7 +324,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     // Other tests will verify the endpoint gets the right payload.
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn simple_with_index() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -369,7 +369,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     // Other tests will verify the endpoint gets the right payload.
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn git_deps() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -407,7 +407,7 @@ the `git` specification will be removed from the dependency declaration.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn path_dependency_no_version() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -447,7 +447,7 @@ the `path` specification will be removed from the dependency declaration.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn unpublishable_crate() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -480,7 +480,7 @@ fn unpublishable_crate() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn dont_publish_dirty() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -521,7 +521,7 @@ to proceed despite this and include the uncommitted changes, pass the `--allow-d
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_clean() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -569,7 +569,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     // Other tests will verify the endpoint gets the right payload.
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_in_sub_repo() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -618,7 +618,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     // Other tests will verify the endpoint gets the right payload.
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_when_ignored() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -667,7 +667,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     // Other tests will verify the endpoint gets the right payload.
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn ignore_when_crate_ignored() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -715,7 +715,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     // Other tests will verify the endpoint gets the right payload.
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn new_crate_rejected() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -750,7 +750,7 @@ fn new_crate_rejected() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn dry_run() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -793,7 +793,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
     assert!(!registry::api_path().join("api/v1/crates/new").exists());
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn registry_not_in_publish_list() {
     let p = project()
         .file(
@@ -826,7 +826,7 @@ The registry `alternative` is not listed in the `package.publish` value in Cargo
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_empty_list() {
     let p = project()
         .file(
@@ -855,7 +855,7 @@ fn publish_empty_list() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_allowed_registry() {
     let _registry = RegistryBuilder::new()
         .http_api()
@@ -915,7 +915,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     );
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_implicitly_to_only_allowed_registry() {
     let _registry = RegistryBuilder::new()
         .http_api()
@@ -976,7 +976,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     );
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_failed_with_index_and_only_allowed_registry() {
     let registry = RegistryBuilder::new()
         .http_api()
@@ -1017,7 +1017,7 @@ fn publish_failed_with_index_and_only_allowed_registry() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_fail_with_no_registry_specified() {
     let p = project().build();
 
@@ -1050,7 +1050,7 @@ fn publish_fail_with_no_registry_specified() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn block_publish_no_registry() {
     let p = project()
         .file(
@@ -1080,7 +1080,7 @@ fn block_publish_no_registry() {
 }
 
 // Explicitly setting `crates-io` in the publish list.
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_with_crates_io_explicit() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -1132,7 +1132,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_with_select_features() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -1183,7 +1183,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_with_all_features() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -1234,7 +1234,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_with_no_default_features() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -1275,7 +1275,7 @@ fn publish_with_no_default_features() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_with_patch() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
     Package::new("bar", "1.0.0").publish();
@@ -1386,7 +1386,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
 }
 
 #[expect(deprecated)]
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_checks_for_token_before_verify() {
     let registry = registry::RegistryBuilder::new()
         .no_configure_token()
@@ -1440,7 +1440,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_with_bad_source() {
     let p = project()
         .file(
@@ -1487,7 +1487,7 @@ include `--registry crates-io` to use crates.io
 }
 
 // A dependency with both `git` and `version`.
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_git_with_version() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -1646,7 +1646,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     );
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_dev_dep_stripping() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
     Package::new("normal-only", "1.0.0")
@@ -2073,7 +2073,7 @@ features = ["cat"]
     );
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn credentials_ambiguous_filename() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -2133,7 +2133,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
 
 // --index will not load registry.token to avoid possibly leaking
 // crates.io token to another server.
-#[cargo_test]
+#[allow(dead_code)]
 fn index_requires_token() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -2168,7 +2168,7 @@ fn index_requires_token() {
 }
 
 // publish with source replacement without --registry
-#[cargo_test]
+#[allow(dead_code)]
 fn cratesio_source_replacement() {
     registry::init();
     let p = project()
@@ -2198,7 +2198,7 @@ include `--registry dummy-registry` or `--registry crates-io`
 }
 
 // Registry returns an API error.
-#[cargo_test]
+#[allow(dead_code)]
 fn api_error_json() {
     let _registry = registry::RegistryBuilder::new()
         .alternative()
@@ -2246,7 +2246,7 @@ Caused by:
 }
 
 // Registry returns an API error with a 200 status code.
-#[cargo_test]
+#[allow(dead_code)]
 fn api_error_200() {
     let _registry = registry::RegistryBuilder::new()
         .alternative()
@@ -2294,7 +2294,7 @@ Caused by:
 }
 
 // Registry returns an error code without a JSON message.
-#[cargo_test]
+#[allow(dead_code)]
 fn api_error_code() {
     let _registry = registry::RegistryBuilder::new()
         .alternative()
@@ -2349,7 +2349,7 @@ Caused by:
 }
 
 // Registry has a network error.
-#[cargo_test]
+#[allow(dead_code)]
 fn api_curl_error() {
     let _registry = registry::RegistryBuilder::new()
         .alternative()
@@ -2399,7 +2399,7 @@ Caused by:
 }
 
 // Registry returns an invalid response.
-#[cargo_test]
+#[allow(dead_code)]
 fn api_other_error() {
     let _registry = registry::RegistryBuilder::new()
         .alternative()
@@ -2449,7 +2449,7 @@ Caused by:
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_package_workspace() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2501,7 +2501,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     validate_upload_li();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn with_duplicate_spec_in_members() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -2557,7 +2557,7 @@ fn with_duplicate_spec_in_members() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_package_workspace_with_members_with_features_old() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2609,7 +2609,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     validate_upload_li();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_virtual_workspace() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -2647,7 +2647,7 @@ fn in_virtual_workspace() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_virtual_workspace_with_p() {
     // `publish` generally requires a remote registry
     let registry = registry::RegistryBuilder::new().http_api().build();
@@ -2706,7 +2706,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_package_workspace_not_found() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -2750,7 +2750,7 @@ fn in_package_workspace_not_found() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_package_workspace_found_multiple() {
     // Use local registry for faster test times since no publish will occur
     let registry = registry::init();
@@ -2806,7 +2806,7 @@ fn in_package_workspace_found_multiple() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 // https://github.com/rust-lang/cargo/issues/10536
 fn publish_path_dependency_without_workspace() {
     // Use local registry for faster test times since no publish will occur
@@ -2852,7 +2852,7 @@ fn publish_path_dependency_without_workspace() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn http_api_not_noop() {
     let registry = registry::RegistryBuilder::new().http_api().build();
 
@@ -2914,7 +2914,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     p.cargo("build").run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn wait_for_first_publish() {
     // Counter for number of tries before the package is "published"
     let arc: Arc<Mutex<u32>> = Arc::new(Mutex::new(0));
@@ -2997,7 +2997,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
 /// A separate test is needed for package names with - or _ as they hit
 /// the responder twice per cargo invocation. If that ever gets changed
 /// this test will need to be changed accordingly.
-#[cargo_test]
+#[allow(dead_code)]
 fn wait_for_first_publish_underscore() {
     // Counter for number of tries before the package is "published"
     let arc: Arc<Mutex<u32>> = Arc::new(Mutex::new(0));
@@ -3094,7 +3094,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     p.cargo("build").with_status(0).run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn wait_for_subsequent_publish() {
     // Counter for number of tries before the package is "published"
     let arc: Arc<Mutex<u32>> = Arc::new(Mutex::new(0));
@@ -3187,7 +3187,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     p.cargo("check").with_status(0).run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn skip_wait_for_publish() {
     // Intentionally using local registry so the crate never makes it to the index
     let registry = registry::init();
@@ -3231,7 +3231,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn timeout_waiting_for_publish() {
     // Publish doesn't happen within the timeout window.
     let registry = registry::RegistryBuilder::new()
@@ -3283,7 +3283,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn timeout_waiting_for_dependency_publish() {
     // Publish doesn't happen within the timeout window.
     let registry = registry::RegistryBuilder::new()
@@ -3383,7 +3383,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn wait_for_git_publish() {
     // Slow publish to an index with a git index.
     let registry = registry::RegistryBuilder::new()