aboutsummaryrefslogtreecommitdiff
path: root/tests/gc.sh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-01 15:15:32 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-01 15:15:32 -0400
commitf7f44f7c96eaa65b096e1448591e5790a58f3ad9 (patch)
tree1fdcfbbc31a1496075dd6796043c75426ee8da1c /tests/gc.sh
parent5abd643c6d10f2cfa6e26652a9688a0263310094 (diff)
parentaa99005004bccc9be506a2a2f162f78bad4bcb41 (diff)
Merge commit 'aa99005004bccc9be506a2a2f162f78bad4bcb41' into ca-drv-exotic
Diffstat (limited to 'tests/gc.sh')
-rw-r--r--tests/gc.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/gc.sh b/tests/gc.sh
index ad09a8b39..98d6cb032 100644
--- a/tests/gc.sh
+++ b/tests/gc.sh
@@ -50,3 +50,20 @@ if test -e $outPath/foobar; then false; fi
# Check that the store is empty.
rmdir $NIX_STORE_DIR/.links
rmdir $NIX_STORE_DIR
+
+## Test `nix-collect-garbage -d`
+# `nix-env` doesn't work with CA derivations, so let's ignore that bit if we're
+# using them
+if [[ -z "${NIX_TESTS_CA_BY_DEFAULT:-}" ]]; then
+ clearProfiles
+ # Run two `nix-env` commands, should create two generations of
+ # the profile
+ nix-env -f ./user-envs.nix -i foo-1.0
+ nix-env -f ./user-envs.nix -i foo-2.0pre1
+ [[ $(nix-env --list-generations | wc -l) -eq 2 ]]
+
+ # Clear the profile history. There should be only one generation
+ # left
+ nix-collect-garbage -d
+ [[ $(nix-env --list-generations | wc -l) -eq 1 ]]
+fi