about summary refs log tree commit diff
path: root/nixos/tests/systemd-initrd-simple.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/systemd-initrd-simple.nix')
-rw-r--r--nixos/tests/systemd-initrd-simple.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/nixos/tests/systemd-initrd-simple.nix b/nixos/tests/systemd-initrd-simple.nix
new file mode 100644
index 000000000000..ba62cdf3bbc7
--- /dev/null
+++ b/nixos/tests/systemd-initrd-simple.nix
@@ -0,0 +1,27 @@
+import ./make-test-python.nix ({ lib, pkgs, ... }: {
+  name = "systemd-initrd-simple";
+
+  machine = { pkgs, ... }: {
+    boot.initrd.systemd = {
+      enable = true;
+      emergencyAccess = true;
+    };
+    fileSystems = lib.mkVMOverride {
+      "/".autoResize = true;
+    };
+  };
+
+  testScript = ''
+    import subprocess
+
+    oldAvail = machine.succeed("df --output=avail / | sed 1d")
+    machine.shutdown()
+
+    subprocess.check_call(["qemu-img", "resize", "vm-state-machine/machine.qcow2", "+1G"])
+
+    machine.start()
+    newAvail = machine.succeed("df --output=avail / | sed 1d")
+
+    assert int(oldAvail) < int(newAvail), "File system did not grow"
+  '';
+})