Skip to content

Commit

Permalink
Test(ship): Add test for install failfast
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
  • Loading branch information
PaulDance committed May 25, 2024
1 parent 24529d2 commit 0bd27d4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/fixtures/ship/validate_ship_install_failfast.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
INFO cargo_liner::cargo > Installing `abc`...
Updating `dummy-registry` index
error: could not find `abc` in registry `crates-io` with version `*`
Error:
0: Failed to install or update the configured packages.
1: Failed to install "abc".
2: Cargo process finished unsuccessfully: exit status: 101

Location:
src/cargo.rs:[..]

Note: This can happen for many reasons.
Suggestion: Read Cargo's output.

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
19 changes: 19 additions & 0 deletions tests/ship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,3 +1044,22 @@ fn validate_ship_cargotermcolor_supported() {
]);
assert_installed("pkg");
}

#[cargo_test]
fn validate_ship_install_failfast() {
let _reg = init_registry();
fake_install_self();
fake_publish("def", "0.0.0");
write_user_config(&["[packages]", "abc = '*'", "def = '*'"]);

cargo_liner()
.args(["ship", "--skip-check", "--no-self"])
.assert()
.failure()
.stdout_eq_("".into_data().raw())
.stderr_eq_(snapbox::file![
"fixtures/ship/validate_ship_install_failfast.stderr"
]);
assert_not_installed("abc");
assert_not_installed("def");
}

0 comments on commit 0bd27d4

Please sign in to comment.