summaryrefslogtreecommitdiffstats
path: root/tests/swap.nix
blob: 4861f8d8c82effbc15564b11c6031290ba09c8c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ pkgs ? (import <nixpkgs> { })
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
}:
makeDiskoTest {
  disko-config = ../example/swap.nix;
  extraTestScript = ''
    machine.succeed("mountpoint /");
    machine.succeed("swapon --show >&2");
    machine.succeed("""
      lsblk --json |
        jq -e '.blockdevices[] |
          select(.name == "vda") |
          .children[] |
          select(.name == "vda3") |
          .children[0].mountpoints[0] == "[SWAP]"
        '
    """);
  '';
  extraConfig = {
    environment.systemPackages = [ pkgs.jq ];
  };
}