diff options
author | Bob van der Linden <bobvanderlinden@gmail.com> | 2023-02-24 21:26:36 +0100 |
---|---|---|
committer | Bob van der Linden <bobvanderlinden@gmail.com> | 2023-02-28 09:28:05 +0100 |
commit | 3efa476c5439f8f6c1968a6ba20a31d1239c2f04 (patch) | |
tree | 2c4d15b512523bfe0326921d3ec137d42f203d22 /tests | |
parent | 872cdb4346f72186ae683f90ac97b8a7d9bddfd4 (diff) |
tests: nix-profile: test install error message upon conflicting files
Diffstat (limited to 'tests')
-rw-r--r-- | tests/nix-profile.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/nix-profile.sh b/tests/nix-profile.sh index 266dc9e49..d4beaa190 100644 --- a/tests/nix-profile.sh +++ b/tests/nix-profile.sh @@ -140,6 +140,32 @@ printf World2 > $flake2Dir/who nix profile install $flake1Dir [[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello World" ]] +expect 1 nix profile install $flake2Dir +diff -u <(nix profile install $flake2Dir 2>&1 1> /dev/null || true) <(cat << EOF +error: An existing package already provides the following file: + + $(nix build --no-link --print-out-paths ${flake1Dir}"#default.out")/bin/hello + + This is the conflicting file from the new package: + + $(nix build --no-link --print-out-paths ${flake2Dir}"#default.out")/bin/hello + + To remove the existing package: + + nix profile remove path:${flake1Dir} + + The new package can also be installed next to the existing one by assigning a different priority. + The conflicting packages have a priority of 5. + To prioritise the new package: + + nix profile install path:${flake2Dir} --priority 4 + + To prioritise the existing package: + + nix profile install path:${flake2Dir} --priority 6 +EOF +) +[[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello World" ]] nix profile install $flake2Dir --priority 100 [[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello World" ]] nix profile install $flake2Dir --priority 0 |