Skip to content

Commit 11d5b73

Browse files
committed
Auto merge of #13789 - cuviper:test-offline, r=weihanglo
Fix 2 tests for offline execution In `alt_registry::warn_for_unused_fields`, the second part of the test runs on `--registry crates-io`, so it needs a local replacement url. In `install::install_global_cargo_config`, it was adding to the "config" file, but the `pkg` before it configured the dummy registry replacement in "config.toml". So that replacement wasn't actually used, and if you ran tests online it was trying to install `bar v0.1.1` from the real registry! The filename is now fixed, and the test double-checks that we're only trying to install the local `bar v0.0.1`.
2 parents d29ad67 + 6dda4e0 commit 11d5b73

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tests/testsuite/alt_registry.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,11 @@ or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN",
15721572
)
15731573
.run();
15741574

1575+
let crates_io = registry::RegistryBuilder::new()
1576+
.no_configure_token()
1577+
.build();
15751578
p.cargo("publish --registry crates-io")
1579+
.replace_crates_io(crates_io.index_url())
15761580
.with_status(101)
15771581
.with_stderr(
15781582
"\

tests/testsuite/install.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,7 @@ fn install_ignores_unstable_table_in_local_cargo_config() {
19811981
fn install_global_cargo_config() {
19821982
pkg("bar", "0.0.1");
19831983

1984-
let config = cargo_home().join("config");
1984+
let config = cargo_home().join("config.toml");
19851985
let mut toml = fs::read_to_string(&config).unwrap_or_default();
19861986

19871987
toml.push_str(
@@ -1994,6 +1994,7 @@ fn install_global_cargo_config() {
19941994

19951995
cargo_process("install bar")
19961996
.with_status(101)
1997+
.with_stderr_contains("[INSTALLING] bar v0.0.1")
19971998
.with_stderr_contains("[..]--target nonexistent[..]")
19981999
.run();
19992000
}

0 commit comments

Comments
 (0)