testing: migrate pass-as-file.sh

Change-Id: I9c3a940ede9353e977e60e0650eaa5a64cc6fa5e
This commit is contained in:
eldritch horrors
2026-02-27 17:42:17 +00:00
parent 32a96169d6
commit b2ae7c3965
3 changed files with 26 additions and 19 deletions
-1
View File
@@ -103,7 +103,6 @@ functional_tests_scripts = [
'selfref-gc.sh',
'db-migration.sh',
'bash-profile.sh',
'pass-as-file.sh',
'store-ping.sh',
'flakes/show.sh',
'path-from-hash-part.sh',
-18
View File
@@ -1,18 +0,0 @@
source common.sh
clearStore
outPath=$(nix-build --no-out-link -E "
with import ./config.nix;
mkDerivation {
name = \"pass-as-file\";
passAsFile = [ \"foo\" ];
foo = [ \"xyzzy\" ];
builder = builtins.toFile \"builder.sh\" ''
[ \"\$(basename \$fooPath)\" = .attr-1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89ic ]
[ \"\$(cat \$fooPath)\" = xyzzy ]
touch \$out
'';
}
")
@@ -0,0 +1,26 @@
from testlib.fixtures.nix import Nix
from testlib.utils import get_global_asset
from testlib.fixtures.file_helper import File, with_files
@with_files(
{
"config.nix": get_global_asset("config.nix"),
"default.nix": File("""
with import ./config.nix;
mkDerivation {
name = "pass-as-file";
passAsFile = [ "foo" ];
foo = [ "xyzzy" ];
builder = builtins.toFile "builder.sh" ''
[ "$(basename $fooPath)" = .attr-1bp7cri8hplaz6hbz0v4f0nl44rl84q1sg25kgwqzipzd1mv89ic ]
[ "$(cat $fooPath)" = xyzzy ]
touch $out
'';
}
"""),
}
)
def test_pass_as_file(nix: Nix):
nix.nix_build([]).run().ok()