summary refs log tree commit diff
path: root/nixos/tests/systemd-initrd-simple.nix
blob: ba62cdf3bbc772241888075d7c43652b8686d868 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"
  '';
})