From ed24c80ef65159238e23b223fbcc6b54ba410075 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Sat, 23 Nov 2024 16:37:31 -0500 Subject: [PATCH] incus: add tpm to container test --- nixos/tests/incus/container.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/tests/incus/container.nix b/nixos/tests/incus/container.nix index 2329721d9504..ffccf6a43ff0 100644 --- a/nixos/tests/incus/container.nix +++ b/nixos/tests/incus/container.nix @@ -36,7 +36,8 @@ in networking.nftables.enable = true; }; - testScript = '' + testScript = # python + '' def instance_is_up(_) -> bool: status, _ = machine.execute("incus exec container --disable-stdin --force-interactive /run/current-system/sw/bin/systemctl -- is-system-running") return status == 0 @@ -94,6 +95,13 @@ in meminfo_bytes = " ".join(meminfo.split(' ')[-2:]) assert meminfo_bytes == "125000 kB", f"Wrong amount of memory reported from /proc/meminfo, want: '125000 kB', got: '{meminfo_bytes}'" + with subtest("virtual tpm can be configured"): + machine.succeed("incus config device add container vtpm tpm path=/dev/tpm0 pathrm=/dev/tpmrm0") + machine.succeed("incus exec container -- test -e /dev/tpm0") + machine.succeed("incus exec container -- test -e /dev/tpmrm0") + machine.succeed("incus config device remove container vtpm") + machine.fail("incus exec container -- test -e /dev/tpm0") + with subtest("lxc-generator"): with subtest("lxc-container generator configures plain container"): # reuse the existing container to save some time