From c7ff56f8cdb8d0a2904c4f00ac01eb9f222175e2 Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Thu, 13 Jun 2024 11:16:38 +0200 Subject: [PATCH] Disable network tests Forwarded: TODO Gbp-Pq: Topic cargo Gbp-Pq: Name c-2002_disable-net-tests.patch --- .../tests/testsuite/credential_process.rs | 14 +-- 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 | 108 +++++++++--------- 4 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/tools/cargo/tests/testsuite/credential_process.rs b/src/tools/cargo/tests/testsuite/credential_process.rs index a07006d549..37b2c07f53 100644 --- a/src/tools/cargo/tests/testsuite/credential_process.rs +++ b/src/tools/cargo/tests/testsuite/credential_process.rs @@ -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() diff --git a/src/tools/cargo/tests/testsuite/git_auth.rs b/src/tools/cargo/tests/testsuite/git_auth.rs index e51c107813..8ec3292b70 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) { } // 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 b765678c71..ed695bd948 100644 --- a/src/tools/cargo/tests/testsuite/net_config.rs +++ b/src/tools/cargo/tests/testsuite/net_config.rs @@ -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( diff --git a/src/tools/cargo/tests/testsuite/publish.rs b/src/tools/cargo/tests/testsuite/publish.rs index cb97657040..394833d16f 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(); @@ -132,7 +132,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly. // 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() @@ -172,7 +172,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() @@ -215,7 +215,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(); @@ -274,7 +274,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(); @@ -319,7 +319,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(); @@ -357,7 +357,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(); @@ -397,7 +397,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(); @@ -430,7 +430,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(); @@ -471,7 +471,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(); @@ -519,7 +519,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(); @@ -568,7 +568,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(); @@ -617,7 +617,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(); @@ -665,7 +665,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(); @@ -700,7 +700,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(); @@ -743,7 +743,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( @@ -776,7 +776,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( @@ -805,7 +805,7 @@ fn publish_empty_list() { .run(); } -#[cargo_test] +#[allow(dead_code)] fn publish_allowed_registry() { let _registry = RegistryBuilder::new() .http_api() @@ -865,7 +865,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() @@ -926,7 +926,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() @@ -968,7 +968,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(); @@ -1002,7 +1002,7 @@ The registry `crates-io` is not listed in the `package.publish` value in Cargo.t .run(); } -#[cargo_test] +#[allow(dead_code)] fn block_publish_no_registry() { let p = project() .file( @@ -1032,7 +1032,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(); @@ -1084,7 +1084,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(); @@ -1135,7 +1135,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(); @@ -1186,7 +1186,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(); @@ -1227,7 +1227,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(); @@ -1338,7 +1338,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly. } #[allow(deprecated)] -#[cargo_test] +#[allow(dead_code)] fn publish_checks_for_token_before_verify() { let registry = registry::RegistryBuilder::new() .no_configure_token() @@ -1392,7 +1392,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( @@ -1439,7 +1439,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(); @@ -1597,7 +1597,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") @@ -1976,7 +1976,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(); @@ -2036,7 +2036,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(); @@ -2071,7 +2071,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() @@ -2101,7 +2101,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() @@ -2149,7 +2149,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() @@ -2197,7 +2197,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() @@ -2252,7 +2252,7 @@ Caused by: } // Registry has a network error. -#[cargo_test] +#[allow(dead_code)] fn api_curl_error() { let _registry = registry::RegistryBuilder::new() .alternative() @@ -2302,7 +2302,7 @@ Caused by: } // Registry returns an invalid response. -#[cargo_test] +#[allow(dead_code)] fn api_other_error() { let _registry = registry::RegistryBuilder::new() .alternative() @@ -2352,7 +2352,7 @@ Caused by: .run(); } -#[cargo_test] +#[allow(dead_code)] fn in_package_workspace() { let registry = RegistryBuilder::new().http_api().http_index().build(); @@ -2404,7 +2404,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(); @@ -2460,7 +2460,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(); @@ -2512,7 +2512,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(); @@ -2550,7 +2550,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(); @@ -2609,7 +2609,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(); @@ -2653,7 +2653,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(); @@ -2709,7 +2709,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 @@ -2755,7 +2755,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(); @@ -2817,7 +2817,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> = Arc::new(Mutex::new(0)); @@ -2900,7 +2900,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> = Arc::new(Mutex::new(0)); @@ -2997,7 +2997,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> = Arc::new(Mutex::new(0)); @@ -3090,7 +3090,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(); @@ -3133,7 +3133,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() @@ -3185,7 +3185,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() -- 2.30.2