From 23e5c76c195e8a09af6e62dfb2b0f4f7f55209c3 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Thu, 7 May 2026 16:04:29 +0200 Subject: [PATCH] nixosTests.systemd-initrd-swraid: test RAID auto-detection I implemented this to verify whether or not #210210 was still an issue and it turns out it had already been fixed. After a lot of investigating I figured out that it was unintentionally fixed by #333643. I tested this by duplicating this commit on top of the commit before that PR and the commit after that PR to verify that PR actually fixed the issue. --- nixos/tests/systemd-initrd-swraid.nix | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/nixos/tests/systemd-initrd-swraid.nix b/nixos/tests/systemd-initrd-swraid.nix index 1a504a4ae4e0..997235ecfcd1 100644 --- a/nixos/tests/systemd-initrd-swraid.nix +++ b/nixos/tests/systemd-initrd-swraid.nix @@ -23,12 +23,7 @@ mdadm e2fsprogs ]; # for mdadm and mkfs.ext4 - boot.swraid = { - enable = true; - mdadmConf = '' - ARRAY /dev/md0 devices=/dev/vdb,/dev/vdc - ''; - }; + boot.swraid.enable = true; environment.etc."mdadm.conf".text = '' MAILADDR test@example.com ''; @@ -64,12 +59,12 @@ assert "hello" in machine.succeed("cat /test") assert "md0" in machine.succeed("cat /proc/mdstat") - expected_config = """MAILADDR test@example.com + # Verify the RAID array was properly auto-detected and assembled + detail = machine.succeed("mdadm --detail /dev/md0") + assert "raid1" in detail, f"Expected raid1 in mdadm detail output: {detail}" + assert "/dev/vdb" in detail, f"Expected /dev/vdb in array: {detail}" + assert "/dev/vdc" in detail, f"Expected /dev/vdc in array: {detail}" - ARRAY /dev/md0 devices=/dev/vdb,/dev/vdc - """ - got_config = machine.execute("cat /etc/mdadm.conf")[1] - assert expected_config == got_config, repr((expected_config, got_config)) machine.wait_for_unit("mdmonitor.service") ''; }