test --disk-encryption-keys in sudo test

This commit is contained in:
Jörg Thalheim 2022-12-31 13:34:37 +01:00
parent c20cb13ab8
commit 1d00a9babd

View File

@ -6,7 +6,8 @@
};
testScript = ''
start_all()
installer.succeed("""
installer.succeed("echo super-secret > /tmp/disk-encryption-key")
output = installer.succeed("""
eval $(ssh-agent)
ssh-add /etc/sshKey
${../nixos-remote} \
@ -14,8 +15,14 @@
--debug \
--kexec /etc/nixos-remote/kexec-installer \
--stop-after-disko \
--disk-encryption-keys /tmp/disk-encryption-key \
--store-paths /etc/nixos-remote/disko /etc/nixos-remote/system-to-install \
nixos@installed >&2
key=$(ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
root@installed cat /tmp/disk-encryption-key)
echo "encryption key: '$key'"
""")
assert "encryption key: 'super-secret'" in output, f"output does not contain expected values: {output}"
'';
}