From 6ddd3045f0b8392c69eafdbdd56886feeca2473d Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Mon, 21 Jul 2025 17:46:53 +0200 Subject: [PATCH] testing: remove obsolete daemon tests remove all daemon version checks targeting daemons we no longer support. Change-Id: If722024c3d66c73fa1b3cdd63134a09389ac6ea5 --- tests/functional/build-delete.sh | 4 +-- tests/functional/check-refs.sh | 13 ++----- tests/functional/fetchClosure.sh | 6 ---- tests/functional/fixed.sh | 12 +++---- tests/functional/meson.build | 1 - .../functional/nix-shell/structured-attrs.sh | 4 --- tests/functional/post-hook.sh | 6 +--- tests/functional/push-to-store-old.sh | 14 -------- tests/functional/remote-store.sh | 13 +++---- tests/functional/selfref-gc.sh | 2 -- tests/functional/store-ping.sh | 2 +- tests/functional/structured-attrs.sh | 4 --- tests/functional/user-envs-migration.sh | 35 ------------------- 13 files changed, 14 insertions(+), 102 deletions(-) delete mode 100755 tests/functional/push-to-store-old.sh delete mode 100644 tests/functional/user-envs-migration.sh diff --git a/tests/functional/build-delete.sh b/tests/functional/build-delete.sh index 9c56b00e8..87c979980 100644 --- a/tests/functional/build-delete.sh +++ b/tests/functional/build-delete.sh @@ -49,6 +49,4 @@ second EOF nix-store --delete "$p" # Clean up for next test } -if isDaemonNewer "2.12pre0"; then - issue_6572_dependent_outputs -fi +issue_6572_dependent_outputs diff --git a/tests/functional/check-refs.sh b/tests/functional/check-refs.sh index d4a5aa29f..4272e23e7 100644 --- a/tests/functional/check-refs.sh +++ b/tests/functional/check-refs.sh @@ -41,16 +41,9 @@ nix-build -o $RESULT check-refs.nix -A test7 # test10 should succeed (no disallowed references). nix-build -o $RESULT check-refs.nix -A test10 -if isDaemonNewer 2.12pre20230103; then - if ! isDaemonNewer 2.16.0; then - enableFeatures discard-references - restartDaemon - fi - - # test11 should succeed. - test11=$(nix-build -o $RESULT check-refs.nix -A test11) - [[ -z $(nix-store -q --references "$test11") ]] -fi +# test11 should succeed. +test11=$(nix-build -o $RESULT check-refs.nix -A test11) +[[ -z $(nix-store -q --references "$test11") ]] # test12 should fail (syntactically invalid). expectStderr 1 nix-build -vvv -o "$RESULT" check-refs.nix -A test12 >"$TEST_ROOT/test12.stderr" diff --git a/tests/functional/fetchClosure.sh b/tests/functional/fetchClosure.sh index 618527fa7..934d28506 100644 --- a/tests/functional/fetchClosure.sh +++ b/tests/functional/fetchClosure.sh @@ -5,12 +5,6 @@ enableFeatures "fetch-closure" clearStore clearCacheCache -# Old daemons don't properly zero out the self-references when -# calculating the CA hashes, so this breaks `nix store -# make-content-addressed` which expects the client and the daemon to -# compute the same hash -requireDaemonNewerThan "2.16.0pre20230524" - # Initialize binary cache. nonCaPath=$(nix build --json --file ./dependencies.nix --no-link | jq -r .[].outputs.out) caPath=$(nix store make-content-addressed --json $nonCaPath | jq -r '.rewrites | map(.) | .[]') diff --git a/tests/functional/fixed.sh b/tests/functional/fixed.sh index 6dc3adfa8..3faf092ed 100644 --- a/tests/functional/fixed.sh +++ b/tests/functional/fixed.sh @@ -15,10 +15,8 @@ nix path-info --json $path | grep fixed:md5:2qk15sxzzjlnpjk9brn7j8ppcd echo 'testing good...' nix-build fixed.nix -A good --no-out-link -if isDaemonNewer "2.4pre20210927"; then - echo 'testing --check...' - nix-build fixed.nix -A check --check && fail "should fail" -fi +echo 'testing --check...' +nix-build fixed.nix -A check --check && fail "should fail" echo 'testing good2...' nix-build fixed.nix -A good2 --no-out-link @@ -26,10 +24,8 @@ nix-build fixed.nix -A good2 --no-out-link echo 'testing reallyBad...' nix-instantiate fixed.nix -A reallyBad && fail "should fail" -if isDaemonNewer "2.20pre20240108"; then - echo 'testing fixed with references...' - expectStderr 1 nix-build fixed.nix -A badReferences | grepQuiet "not allowed to refer to other store paths" -fi +echo 'testing fixed with references...' +expectStderr 1 nix-build fixed.nix -A badReferences | grepQuiet "not allowed to refer to other store paths" echo 'testing illegal references...' # Fixed FOD hashes cannot be asserted because: diff --git a/tests/functional/meson.build b/tests/functional/meson.build index d682462c6..4a3edefbb 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -61,7 +61,6 @@ functional_tests_scripts = [ 'fetchMercurial.sh', 'gc-auto.sh', 'user-envs.sh', - 'user-envs-migration.sh', 'binary-cache.sh', 'binary-cache-regression-fj647.sh', 'multiple-outputs.sh', diff --git a/tests/functional/nix-shell/structured-attrs.sh b/tests/functional/nix-shell/structured-attrs.sh index 1d2fa8fed..1f43677da 100644 --- a/tests/functional/nix-shell/structured-attrs.sh +++ b/tests/functional/nix-shell/structured-attrs.sh @@ -1,9 +1,5 @@ source ../common.sh -# 27ce722638 required some incompatible changes to the nix file, so skip this -# tests for the older versions -requireDaemonNewerThan "2.4pre20210712" - clearStore export NIX_BUILD_SHELL=$SHELL diff --git a/tests/functional/post-hook.sh b/tests/functional/post-hook.sh index 4be7da417..78760af5f 100644 --- a/tests/functional/post-hook.sh +++ b/tests/functional/post-hook.sh @@ -9,11 +9,7 @@ echo 'require-sigs = false' >> $NIX_CONF_DIR/nix.conf restartDaemon -if isDaemonNewer "2.13"; then - pushToStore="$PWD/push-to-store.sh" -else - pushToStore="$PWD/push-to-store-old.sh" -fi +pushToStore="$PWD/push-to-store.sh" # Build the dependencies and push them to the remote store. nix-build -o $TEST_ROOT/result dependencies.nix --post-build-hook "$pushToStore" diff --git a/tests/functional/push-to-store-old.sh b/tests/functional/push-to-store-old.sh deleted file mode 100755 index 21f55b70e..000000000 --- a/tests/functional/push-to-store-old.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -x -set -e - -[ -n "$OUT_PATHS" ] -[ -n "$DRV_PATH" ] - -echo Pushing "$OUT_PATHS" to "$REMOTE_STORE" -if [ -n "$BUILD_HOOK_ONLY_OUT_PATHS" ]; then - printf "%s" "$OUT_PATHS" | xargs nix copy --to "$REMOTE_STORE" --no-require-sigs -else - printf "%s" "$DRV_PATH" | xargs nix copy --to "$REMOTE_STORE" --no-require-sigs -fi diff --git a/tests/functional/remote-store.sh b/tests/functional/remote-store.sh index 3ec7f25be..e8d8e20f3 100644 --- a/tests/functional/remote-store.sh +++ b/tests/functional/remote-store.sh @@ -10,15 +10,10 @@ nix --store ssh-ng://localhost?remote-store=$TEST_ROOT/other-store store ping -- startDaemon -if isDaemonNewer "2.15pre0"; then - # Ensure that ping works trusted with new daemon - nix store ping --json | jq -e '.trusted' - # Suppress grumpiness about multiple nixes on PATH - (nix doctor || true) 2>&1 | grep 'You are trusted by' -else - # And the the field is absent with the old daemon - nix store ping --json | jq -e 'has("trusted") | not' -fi +# Ensure that ping works trusted with new daemon +nix store ping --json | jq -e '.trusted' +# Suppress grumpiness about multiple nixes on PATH +(nix doctor || true) 2>&1 | grep 'You are trusted by' # Test import-from-derivation through the daemon. [[ $(nix eval --impure --raw --file ./ifd.nix) = hi ]] diff --git a/tests/functional/selfref-gc.sh b/tests/functional/selfref-gc.sh index 3f1f50eea..cf1c4d18e 100644 --- a/tests/functional/selfref-gc.sh +++ b/tests/functional/selfref-gc.sh @@ -1,7 +1,5 @@ source common.sh -requireDaemonNewerThan "2.6.0pre20211215" - clearStore nix-build --no-out-link -E ' diff --git a/tests/functional/store-ping.sh b/tests/functional/store-ping.sh index d84247ad5..7c0c11fa9 100644 --- a/tests/functional/store-ping.sh +++ b/tests/functional/store-ping.sh @@ -5,7 +5,7 @@ STORE_INFO_JSON=$(nix store ping --json) echo "$STORE_INFO" | grep "Store URL: ${NIX_REMOTE}" -if [[ -v NIX_DAEMON_PACKAGE ]] && isDaemonNewer "2.7.0pre20220126"; then +if [[ -v NIX_DAEMON_PACKAGE ]] then DAEMON_VERSION=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version | cut -d' ' -f3) echo "$STORE_INFO" | grep "Version: $DAEMON_VERSION" [[ "$(echo "$STORE_INFO_JSON" | jq -r ".version")" == "$DAEMON_VERSION" ]] diff --git a/tests/functional/structured-attrs.sh b/tests/functional/structured-attrs.sh index 86d8b76c3..dcfe6d580 100644 --- a/tests/functional/structured-attrs.sh +++ b/tests/functional/structured-attrs.sh @@ -1,9 +1,5 @@ source common.sh -# 27ce722638 required some incompatible changes to the nix file, so skip this -# tests for the older versions -requireDaemonNewerThan "2.4pre20210712" - clearStore rm -f $TEST_ROOT/result diff --git a/tests/functional/user-envs-migration.sh b/tests/functional/user-envs-migration.sh deleted file mode 100644 index 187372b16..000000000 --- a/tests/functional/user-envs-migration.sh +++ /dev/null @@ -1,35 +0,0 @@ -# Test that the migration of user environments -# (https://github.com/NixOS/nix/pull/5226) does preserve everything - -source common.sh - -if isDaemonNewer "2.4pre20211005"; then - skipTest "Daemon is too new" -fi - - -killDaemon -unset NIX_REMOTE - -clearStore -clearProfiles -rm -rf ~/.nix-profile - -# Fill the environment using the older Nix -PATH_WITH_NEW_NIX="$PATH" -export PATH="$NIX_DAEMON_PACKAGE/bin:$PATH" - -nix-env -f user-envs.nix -i foo-1.0 -nix-env -f user-envs.nix -i bar-0.1 - -# Migrate to the new profile dir, and ensure that everything’s 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"