Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests/user-envs-migration.sh #8079

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 11 additions & 9 deletions tests/user-envs-migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

source common.sh

if isDaemonNewer "2.4pre20211005"; then
if isDaemonNewer "2.14"; then
skipTest "Daemon is too new"
fi

Expand All @@ -25,11 +25,13 @@ nix-env -f user-envs.nix -i bar-0.1
# Migrate to the new profile dir, and ensure that everything鈥檚 there
export PATH="$PATH_WITH_NEW_NIX"
nix-env -q # Trigger the migration
( [[ -L ~/.nix-profile ]] && \
[[ $(readlink ~/.nix-profile) == ~/.local/share/nix/profiles/profile ]] ) || \
fail "The nix profile should point to the new location"

(nix-env -q | grep foo && nix-env -q | grep bar && \
[[ -e ~/.nix-profile/bin/foo ]] && \
[[ $(nix-env --list-generations | wc -l) == 2 ]]) ||
fail "The nix profile should have the same content as before the migration"

# The nix profile should point to the new location
[[ -L ~/.nix-profile ]]
[[ $(readlink ~/.nix-profile) == ~/.local/state/nix/profiles/profile ]]
Comment on lines +29 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, that section is actually completely broken, I removed this migration from the original PR after some review suggested it 馃 . So ~/.nix-profile should still point to the original location

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha! Sorry, I should have marked this as draft as I opened it before tests. So I guess we can instead test that the migration doesn't happen until later OK.

Will rework.

(And I realized how I can run the tests incrementally, just define the env var. Whew. That helps.)


# The nix profile should have the same content as before the migration
nix-env -q | grepQuiet foo
nix-env -q | grepQuiet bar
[[ -e ~/.nix-profile/bin/foo ]]
[[ $(nix-env --list-generations | wc -l) == 2 ]]