summary refs log tree commit diff
path: root/nixos/tests/systemd-initrd-simple.nix
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2022-03-20 23:51:50 -0400
committerWill Fancher <elvishjerricco@gmail.com>2022-03-22 21:28:51 -0400
commit243134704201713c853056f051574d26339e50b6 (patch)
treed4c8f5f04b99fc21eec9dcbfb96b9846d22b77be /nixos/tests/systemd-initrd-simple.nix
parent9828446608cfc3c184ee030fcdf6d2092d22d2fb (diff)
downloadnixpkgs-243134704201713c853056f051574d26339e50b6.tar
nixpkgs-243134704201713c853056f051574d26339e50b6.tar.gz
nixpkgs-243134704201713c853056f051574d26339e50b6.tar.bz2
nixpkgs-243134704201713c853056f051574d26339e50b6.tar.lz
nixpkgs-243134704201713c853056f051574d26339e50b6.tar.xz
nixpkgs-243134704201713c853056f051574d26339e50b6.tar.zst
nixpkgs-243134704201713c853056f051574d26339e50b6.zip
systemd-initrd: Test autoResize
Diffstat (limited to 'nixos/tests/systemd-initrd-simple.nix')
-rw-r--r--nixos/tests/systemd-initrd-simple.nix17
1 files changed, 15 insertions, 2 deletions
diff --git a/nixos/tests/systemd-initrd-simple.nix b/nixos/tests/systemd-initrd-simple.nix
index d0786239b51..4b3f56e472a 100644
--- a/nixos/tests/systemd-initrd-simple.nix
+++ b/nixos/tests/systemd-initrd-simple.nix
@@ -1,11 +1,24 @@
-import ./make-test-python.nix ({ pkgs, ... }: {
+import ./make-test-python.nix ({ lib, pkgs, ... }: {
   name = "systemd-initrd-simple";
 
   machine = { pkgs, ... }: {
     boot.initrd.systemd.enable = true;
+    fileSystems = lib.mkVMOverride {
+      "/".autoResize = true;
+    };
   };
 
   testScript = ''
-    machine.wait_for_unit("basic.target")
+    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"
   '';
 })