From: Ximin Luo <infinity0@debian.org>
Date: Thu, 13 Jun 2024 11:16:38 +0200
Subject: Disable network tests

Forwarded: TODO
---
 .../cargo/tests/testsuite/credential_process.rs    |  16 +--
 src/tools/cargo/tests/testsuite/git_auth.rs        |   4 +-
 src/tools/cargo/tests/testsuite/net_config.rs      |   4 +-
 src/tools/cargo/tests/testsuite/publish.rs         | 115 +++++++++++----------
 4 files changed, 70 insertions(+), 69 deletions(-)

diff --git a/src/tools/cargo/tests/testsuite/credential_process.rs b/src/tools/cargo/tests/testsuite/credential_process.rs
index b3823a1..51a03ed 100644
--- a/src/tools/cargo/tests/testsuite/credential_process.rs
+++ b/src/tools/cargo/tests/testsuite/credential_process.rs
@@ -66,7 +66,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();
@@ -88,7 +88,7 @@ You may press ctrl-c [..]
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn credential_provider_auth_failure() {
     let _reg = registry::RegistryBuilder::new()
         .http_index()
@@ -113,7 +113,7 @@ Caused by:
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn basic_unsupported() {
     // Non-action commands don't support login/logout.
     let registry = registry::RegistryBuilder::new()
@@ -148,7 +148,7 @@ Caused by:
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn login() {
     let registry = registry::RegistryBuilder::new()
         .no_configure_token()
@@ -170,7 +170,7 @@ fn login() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn logout() {
     let server = registry::RegistryBuilder::new()
         .no_configure_token()
@@ -189,7 +189,7 @@ fn logout() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn yank() {
     let (p, _t) = get_token_test();
 
@@ -204,7 +204,7 @@ fn yank() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn owner() {
     let (p, _t) = get_token_test();
 
@@ -219,7 +219,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()
diff --git a/src/tools/cargo/tests/testsuite/git_auth.rs b/src/tools/cargo/tests/testsuite/git_auth.rs
index c99ae79..f7ec848 100644
--- a/src/tools/cargo/tests/testsuite/git_auth.rs
+++ b/src/tools/cargo/tests/testsuite/git_auth.rs
@@ -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();
diff --git a/src/tools/cargo/tests/testsuite/net_config.rs b/src/tools/cargo/tests/testsuite/net_config.rs
index f1be9b2..cc001c2 100644
--- a/src/tools/cargo/tests/testsuite/net_config.rs
+++ b/src/tools/cargo/tests/testsuite/net_config.rs
@@ -4,7 +4,7 @@ use crate::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(
diff --git a/src/tools/cargo/tests/testsuite/publish.rs b/src/tools/cargo/tests/testsuite/publish.rs
index c40c9e9..3983661 100644
--- a/src/tools/cargo/tests/testsuite/publish.rs
+++ b/src/tools/cargo/tests/testsuite/publish.rs
@@ -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();
@@ -410,7 +410,7 @@ Caused by:
         .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();
@@ -453,7 +453,7 @@ Caused by:
         .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();
@@ -486,7 +486,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();
@@ -527,7 +527,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();
@@ -575,7 +575,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();
@@ -624,7 +624,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();
@@ -673,7 +673,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();
@@ -721,7 +721,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();
@@ -756,7 +756,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();
@@ -799,7 +799,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(
@@ -832,7 +832,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(
@@ -861,7 +861,7 @@ fn publish_empty_list() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_allowed_registry() {
     let _registry = RegistryBuilder::new()
         .http_api()
@@ -921,7 +921,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()
@@ -982,7 +982,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()
@@ -1023,7 +1023,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();
 
@@ -1056,7 +1056,7 @@ fn publish_fail_with_no_registry_specified() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn block_publish_no_registry() {
     let p = project()
         .file(
@@ -1086,7 +1086,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();
@@ -1138,7 +1138,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();
@@ -1189,7 +1189,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();
@@ -1240,7 +1240,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();
@@ -1281,7 +1281,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();
@@ -1391,7 +1391,8 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
     );
 }
 
-#[cargo_test]
+#[expect(deprecated)]
+#[allow(dead_code)]
 fn publish_checks_for_token_before_verify() {
     let registry = registry::RegistryBuilder::new()
         .no_configure_token()
@@ -1445,7 +1446,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(
@@ -1492,7 +1493,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();
 
@@ -1662,7 +1663,7 @@ dependencies = [
     );
 }
 
-#[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")
@@ -2098,7 +2099,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();
@@ -2158,7 +2159,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();
@@ -2193,7 +2194,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()
@@ -2223,7 +2224,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()
@@ -2271,7 +2272,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()
@@ -2319,7 +2320,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()
@@ -2374,7 +2375,7 @@ Caused by:
 }
 
 // Registry has a network error.
-#[cargo_test]
+#[allow(dead_code)]
 fn api_curl_error() {
     let _registry = registry::RegistryBuilder::new()
         .alternative()
@@ -2424,7 +2425,7 @@ Caused by:
 }
 
 // Registry returns an invalid response.
-#[cargo_test]
+#[allow(dead_code)]
 fn api_other_error() {
     let _registry = registry::RegistryBuilder::new()
         .alternative()
@@ -2474,7 +2475,7 @@ Caused by:
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_package_workspace() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2526,7 +2527,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() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2595,7 +2596,7 @@ You may press ctrl-c to skip waiting; the crates should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_package_workspace_with_members_with_features_old() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2647,7 +2648,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() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2692,7 +2693,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_virtual_workspace_with_p() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2750,7 +2751,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();
@@ -2794,7 +2795,7 @@ fn in_package_workspace_not_found() {
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn in_package_workspace_found_multiple() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2863,7 +2864,7 @@ You may press ctrl-c to skip waiting; the crates should be available shortly.
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn publish_path_dependency_without_workspace() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
@@ -2907,7 +2908,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();
 
@@ -2969,7 +2970,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));
@@ -3052,7 +3053,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));
@@ -3149,7 +3150,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));
@@ -3242,7 +3243,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();
@@ -3286,7 +3287,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()
@@ -3338,7 +3339,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()
@@ -3438,7 +3439,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn package_selection() {
     let registry = registry::RegistryBuilder::new().http_api().build();
     let p = project()
@@ -3513,7 +3514,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
         .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()
@@ -4278,7 +4279,7 @@ Caused by:
         .run();
 }
 
-#[cargo_test]
+#[allow(dead_code)]
 fn all_unpublishable_packages() {
     let registry = RegistryBuilder::new().http_api().http_index().build();
 
