systemd-initrd: Test autoResize

This commit is contained in:
Will Fancher 2022-03-20 23:51:50 -04:00
parent 9828446608
commit 2431347042

View file

@ -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"
'';
})