about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authornikstur <nikstur@outlook.com>2023-02-14 19:39:08 +0100
committernikstur <nikstur@outlook.com>2023-02-14 19:42:32 +0100
commitb1ff1e165821a6842f05cd358a8379ea60bd867b (patch)
tree65af3a6462679b380fadec2f53b6e0b3aa603809 /nixos/tests
parent8422db6f0da1b2e7920f1d0c3be4c2e583a497a1 (diff)
nixos/systemd-repart: enable running after initrd
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/systemd-repart.nix34
1 files changed, 30 insertions, 4 deletions
diff --git a/nixos/tests/systemd-repart.nix b/nixos/tests/systemd-repart.nix
index 92cc1fb04edc0..36de5d988fdb1 100644
--- a/nixos/tests/systemd-repart.nix
+++ b/nixos/tests/systemd-repart.nix
@@ -52,9 +52,6 @@ let
       };
     };
 
-    boot.initrd.systemd.enable = true;
-    boot.initrd.systemd.repart.enable = true;
-
     # systemd-repart operates on disks with a partition table. The qemu module,
     # however, creates separate filesystem images without a partition table, so
     # we have to create a disk image manually.
@@ -88,7 +85,10 @@ in
     nodes.machine = { config, pkgs, ... }: {
       imports = [ common ];
 
-      boot.initrd.systemd.repart.partitions = {
+      boot.initrd.systemd.enable = true;
+
+      boot.initrd.systemd.repart.enable = true;
+      systemd.repart.partitions = {
         "10-root" = {
           Type = "linux-generic";
         };
@@ -105,4 +105,30 @@ in
       assert "Growing existing partition 1." in systemd_repart_logs
     '';
   };
+
+  after-initrd = makeTest {
+    name = "systemd-repart-after-initrd";
+    meta.maintainers = with maintainers; [ nikstur ];
+
+    nodes.machine = { config, pkgs, ... }: {
+      imports = [ common ];
+
+      systemd.repart.enable = true;
+      systemd.repart.partitions = {
+        "10-root" = {
+          Type = "linux-generic";
+        };
+      };
+    };
+
+    testScript = { nodes, ... }: ''
+      ${useDiskImage nodes.machine}
+
+      machine.start()
+      machine.wait_for_unit("multi-user.target")
+
+      systemd_repart_logs = machine.succeed("journalctl --unit systemd-repart.service")
+      assert "Growing existing partition 1." in systemd_repart_logs
+    '';
+  };
 }