From 4962f0d92f958d8d9056415dc479cbf5c91c6d79 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 18 May 2026 14:13:51 +0200 Subject: [PATCH] tests: add luks-fido2 install-test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `example/luks-fido2.nix` has been pure example up to now — no corresponding install-test. Add `tests/luks-fido2.nix` using the existing `makeDiskoTest` shim, exercising the FIDO2-enrolled LUKS path: - `enableCanokey = true` attaches a virtual Canokey to both the formatter VM (where disko runs `systemd-cryptenroll --fido2-device=auto` during the format phase) and the booted machine (where the initrd auto-unlocks LUKS via FIDO2). Canokey emulates a FIDO2 token at `/dev/hidraw*` and answers programmatically, so neither phase needs a user tap. - `extraTestScript` asserts the LUKS volume exists at the expected device path and `/` is mounted — which is only true if the initrd's FIDO2 unlock succeeded. Added in the pre-refactor (legacy `makeDiskoTest` function-call) shape so the subsequent tests/ modulification commit converts it alongside the other tests in one sweep. --- tests/luks-fido2.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/luks-fido2.nix diff --git a/tests/luks-fido2.nix b/tests/luks-fido2.nix new file mode 100644 index 0000000..2a02957 --- /dev/null +++ b/tests/luks-fido2.nix @@ -0,0 +1,14 @@ +{ + pkgs ? import { }, + diskoLib ? pkgs.callPackage ../lib { }, +}: +diskoLib.testLib.makeDiskoTest { + inherit pkgs; + name = "luks-fido2"; + disko-config = ../example/luks-fido2.nix; + enableCanokey = true; + extraTestScript = '' + machine.succeed("cryptsetup isLuks /dev/vda2"); + machine.succeed("mountpoint /"); + ''; +}