aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-06-15 12:11:31 +0200
committerregnat <rg@regnat.ovh>2021-06-15 12:11:31 +0200
commita3ce88725b44a30184cbe8706fc3a53a8610cc47 (patch)
tree4ab331bb27e6f8540eefdc85498110ec94fbbb8b
parent96d7170e12c75acf363bf7a5a081a86b3c384384 (diff)
Add a test for the gc with CA derivations
Also add a small architecture to easily run CA-enabled tests
-rwxr-xr-xtests/ca/gc.sh12
-rw-r--r--tests/config.nix.in11
-rw-r--r--tests/local.mk1
3 files changed, 23 insertions, 1 deletions
diff --git a/tests/ca/gc.sh b/tests/ca/gc.sh
new file mode 100755
index 000000000..e4f9857d6
--- /dev/null
+++ b/tests/ca/gc.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+# Ensure that garbage collection works properly with ca derivations
+
+source common.sh
+
+sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_DIR"/nix.conf
+
+export NIX_TESTS_CA_BY_DEFAULT=1
+
+cd ..
+source gc.sh
diff --git a/tests/config.nix.in b/tests/config.nix.in
index a57a8c596..9b00d9ddb 100644
--- a/tests/config.nix.in
+++ b/tests/config.nix.in
@@ -1,3 +1,12 @@
+let
+ contentAddressedByDefault = builtins.getEnv "NIX_TESTS_CA_BY_DEFAULT" == "1";
+ caArgs = if contentAddressedByDefault then {
+ __contentAddressed = true;
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ } else {};
+in
+
rec {
shell = "@bash@";
@@ -15,4 +24,4 @@ rec {
PATH = path;
} // removeAttrs args ["builder" "meta"])
// { meta = args.meta or {}; };
-}
+} // caArgs
diff --git a/tests/local.mk b/tests/local.mk
index 59eb4eb0f..e40178b80 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -2,6 +2,7 @@ nix_tests = \
hash.sh lang.sh add.sh simple.sh dependencies.sh \
config.sh \
gc.sh \
+ ca/gc.sh \
gc-concurrent.sh \
gc-auto.sh \
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \