mirror of
https://github.com/ryantm/agenix.git
synced 2024-12-23 08:08:29 +03:00
Add integration test for armored secret
This commit is contained in:
parent
c14be7210e
commit
af954310f1
1 changed files with 7 additions and 0 deletions
|
@ -63,6 +63,10 @@ pkgs.nixosTest {
|
|||
file = ../example/secret2.age;
|
||||
path = "/home/user1/secret2";
|
||||
};
|
||||
secrets.armored-secret = {
|
||||
file = ../example/armored-secret.age;
|
||||
path = "/home/user1/armored-secret";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -71,6 +75,7 @@ pkgs.nixosTest {
|
|||
user = "user1";
|
||||
password = "password1234";
|
||||
secret2 = "world!";
|
||||
armored-secret = "Hello World!";
|
||||
in ''
|
||||
system1.wait_for_unit("multi-user.target")
|
||||
system1.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
|
||||
|
@ -89,8 +94,10 @@ pkgs.nixosTest {
|
|||
system1.wait_for_file("/tmp/1")
|
||||
assert "${user}" in system1.succeed("cat /tmp/1")
|
||||
system1.send_chars("cat /run/user/$(id -u)/agenix/secret2 > /tmp/2\n")
|
||||
system1.send_chars("cat /run/user/$(id -u)/agenix/armored-secret > /tmp/3\n")
|
||||
system1.wait_for_file("/tmp/2")
|
||||
assert "${secret2}" in system1.succeed("cat /tmp/2")
|
||||
assert "${armored-secret}" in system1.succeed("cat /tmp/3")
|
||||
|
||||
userDo = lambda input : f"sudo -u user1 -- bash -c 'set -eou pipefail; cd /tmp/secrets; {input}'"
|
||||
|
||||
|
|
Loading…
Reference in a new issue