about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2022-04-03 15:53:02 +0200
committerGitHub <noreply@github.com>2022-04-03 15:53:02 +0200
commit7cdc4dd5d1a2869d6e3c089f960ed6feae06ae77 (patch)
tree75022465e14ef14779c364a0c1578837ed9b29f1 /nixos/tests
parent803c1abb38afa5037f9576796a32248d2a7ecbcf (diff)
parent7ebb4ebe404a7ecf6ee9761aab7d02cd4e2a4abc (diff)
Merge pull request #164943 from ElvishJerricco/systemd-initrd-reuse-systemd-module
initrd: Opt-in bare bones systemd-based initrd
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/systemd-initrd-simple.nix27
2 files changed, 28 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index cf4bfecf6f193..dcbdf34e9441c 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -514,6 +514,7 @@ in
   systemd-confinement = handleTest ./systemd-confinement.nix {};
   systemd-cryptenroll = handleTest ./systemd-cryptenroll.nix {};
   systemd-escaping = handleTest ./systemd-escaping.nix {};
+  systemd-initrd-simple = handleTest ./systemd-initrd-simple.nix {};
   systemd-journal = handleTest ./systemd-journal.nix {};
   systemd-machinectl = handleTest ./systemd-machinectl.nix {};
   systemd-networkd = handleTest ./systemd-networkd.nix {};
diff --git a/nixos/tests/systemd-initrd-simple.nix b/nixos/tests/systemd-initrd-simple.nix
new file mode 100644
index 0000000000000..ba62cdf3bbc77
--- /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"
+  '';
+})