test use of template for an env file

This commit is contained in:
Kiara Grouwstra 2025-06-22 10:28:27 +02:00
parent 437fd19b72
commit ad4090e65a
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU

View file

@ -17,14 +17,14 @@ in (nixpkgs.lib.nixos.runTest {
ExecStartPre = "${legacyPackages.${system}.template_text { ExecStartPre = "${legacyPackages.${system}.template_text {
name = "test"; name = "test";
text = '' text = ''
public text foo=${legacyPackages.${system}.fileContents secret_file}
${legacyPackages.${system}.fileContents secret_file}
''; '';
outPath = "./test"; outPath = "./test";
}}/bin/test"; }}/bin/test";
environmentFile = "./test";
ExecStart = pkgs.writeScript "test_file_got_templates" '' ExecStart = pkgs.writeScript "test_file_got_templates" ''
#!/bin/sh #!/bin/sh
cat ./test | grep -q 'secret' env > ./env
''; '';
}; };
}; };
@ -35,6 +35,8 @@ in (nixpkgs.lib.nixos.runTest {
start_all() start_all()
print(machine.execute("uname -a")) print(machine.execute("uname -a"))
machine.wait_for_unit("multi-user.target") machine.wait_for_unit("multi-user.target")
print(machine.succeed("cat /test | grep -q secret")) print(machine.succeed("cat /test"))
print(machine.succeed("cat /env"))
print(machine.succeed("cat /env | grep -q secret"))
''; '';
}) })