Skip to content

Commit 374974c

Browse files
Prevent undeclared public network access
Stop a few tests which aren't marked with `public_network_test` from trying to access crates.io.
1 parent 585f66a commit 374974c

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

tests/testsuite/cargo_add/normalize_name_path_existing/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ use cargo_test_support::Project;
77

88
#[cargo_test]
99
fn case() {
10+
// Prevent network access by initializing the dummy registry.
11+
cargo_test_support::registry::init();
12+
1013
let project = Project::from_template(current_dir!().join("in"));
1114
let project_root = project.root();
1215
let cwd = &project_root;

tests/testsuite/cargo_add/normalize_name_path_existing/stderr.term.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/testsuite/cargo_info/within_ws_with_alternative_registry/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ use cargo_test_support::{current_dir, file};
44

55
#[cargo_test]
66
fn case() {
7+
// Prevent network access by initializing the dummy registry.
8+
cargo_test_support::registry::init();
9+
710
let _ = RegistryBuilder::new()
811
.alternative()
912
.no_configure_token()

tests/testsuite/cargo_info/within_ws_with_alternative_registry/stderr.term.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/testsuite/package.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6065,6 +6065,9 @@ src/main.rs
60656065

60666066
#[cargo_test]
60676067
fn workspace_with_local_deps_index_mismatch() {
6068+
// Prevent network access by initializing the dummy registry.
6069+
registry::init();
6070+
60686071
let alt_reg = registry::RegistryBuilder::new()
60696072
.http_api()
60706073
.http_index()
@@ -6123,12 +6126,12 @@ fn workspace_with_local_deps_index_mismatch() {
61236126
[PACKAGING] level2 v0.0.1 ([ROOT]/foo/level2)
61246127
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
61256128
[PACKAGING] level1 v0.0.1 ([ROOT]/foo/level1)
6126-
[UPDATING] crates.io index
6129+
[UPDATING] `dummy-registry` index
61276130
[ERROR] failed to prepare local package for uploading
61286131
61296132
Caused by:
61306133
no matching package named `level2` found
6131-
location searched: crates.io index
6134+
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
61326135
required by package `level1 v0.0.1 ([ROOT]/foo/level1)`
61336136
61346137
"#]])

0 commit comments

Comments
 (0)