aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2024-01-12 16:33:15 +0100
committerQyriad <qyriad@qyriad.me>2024-05-02 12:59:15 -0600
commit5d2031f92de4fec9e82f6e591772a8859c85c8b7 (patch)
tree1f7c9e3dcfdf42d5bb77d9fee437e373fc2e2498 /tests
parente0911eef73e36d5b42ebd2e9fa114d535ab287f7 (diff)
Add profile migration test
(cherry picked from commit 72560f7bbef2ab3c02b8ca040fe084328bdd5fbe) Upstream-PR: https://github.com/NixOS/nix/pull/9656 Change-Id: I405e5848e2627a76940220fb6aebadfb8f094afb
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/nix-profile.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/functional/nix-profile.sh b/tests/functional/nix-profile.sh
index 0f17e96ee..ed014f9ef 100644
--- a/tests/functional/nix-profile.sh
+++ b/tests/functional/nix-profile.sh
@@ -194,3 +194,12 @@ nix profile install $flake2Dir --priority 0
clearProfiles
nix profile install $(nix build $flake1Dir --no-link --print-out-paths)
expect 1 nix profile install --impure --expr "(builtins.getFlake ''$flake2Dir'').packages.$system.default"
+
+# Test upgrading from profile version 2.
+clearProfiles
+mkdir -p $TEST_ROOT/import-profile
+outPath=$(nix build --no-link --print-out-paths $flake1Dir/flake.nix^out)
+printf '{ "version": 2, "elements": [ { "active": true, "attrPath": "legacyPackages.x86_64-linux.hello", "originalUrl": "flake:nixpkgs", "outputs": null, "priority": 5, "storePaths": [ "%s" ], "url": "github:NixOS/nixpkgs/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] }' "$outPath" > $TEST_ROOT/import-profile/manifest.json
+nix build --profile $TEST_HOME/.nix-profile $(nix store add-path $TEST_ROOT/import-profile)
+nix profile list | grep -A4 'Name:.*hello' | grep "Store paths:.*$outPath"
+nix profile remove hello 2>&1 | grep 'removed 1 packages, kept 0 packages'