From b7e5aaf90d50d06e057cceefaa831ea5e4a671bd Mon Sep 17 00:00:00 2001 From: cidkidnix Date: Mon, 15 May 2023 13:40:01 -0500 Subject: [PATCH] Add test for checking that we reject bad local overlay store uris --- tests/overlay-local-store/inner.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/overlay-local-store/inner.sh b/tests/overlay-local-store/inner.sh index 7ab587b87..c8d49eb19 100755 --- a/tests/overlay-local-store/inner.sh +++ b/tests/overlay-local-store/inner.sh @@ -14,6 +14,16 @@ storeA="$TEST_ROOT/store-a" storeBTop="$TEST_ROOT/store-b" storeB="local-overlay?root=$TEST_ROOT/merged-store&lower-store=$storeA&upper-layer=$storeBTop" +mkdir -p $TEST_ROOT/bad_test +badTestRoot=$TEST_ROOT/bad_test +storeBadRoot="local-overlay?root=$badTestRoot&lower-store=$storeA&upper-layer=$storeBTop" +storeBadLower="local-overlay?root=$TEST_ROOT/merged-store&lower-store=$badTestRoot&upper-layer=$storeBTop" +storeBadUpper="local-overlay?root=$TEST_ROOT/merged-store&lower-store=$storeA&upper-layer=$badTestRoot" + +declare -a storesBad=( + "$storeBadRoot" "$storeBadLower" "$storeBadUpper" +) + mkdir -p "$TEST_ROOT"/{store-a,store-b,merged-store/nix/store,workdir} # Mounting Overlay Store @@ -105,6 +115,11 @@ expect 1 stat $(toRealPath "$storeBTop/nix/store" "$path") path=$(nix-store --store "$storeB" --add dummy) +for i in "${storesBad[@]}"; do + echo $i + expectStderr 1 nix-store --store "$i" --add dummy | grepQuiet "overlay filesystem .* mounted incorrectly" +done + # lower store should have it from before stat $(toRealPath "$storeA/nix/store" "$path")