summaryrefslogtreecommitdiffstats
path: root/nixos/tests/rasdaemon.nix
blob: b6f6bcbe658be52bad6659de1b084384362cfe29 (plain)
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
28
29
30
31
32
33
34
35
36
{ pkgs, ... }:
{
  name = "rasdaemon";
  meta = {
    inherit (pkgs.rasdaemon.meta) maintainers;
  };

  nodes.machine =
    { pkgs, ... }:
    {
      imports = [ ../modules/profiles/minimal.nix ];
      hardware.rasdaemon = {
        enable = true;
        # should be enabled by default, just making sure
        record = true;
        # nonsense label
        labels = ''
          vendor: none
            product: none
            model: none
              DIMM_0: 0.0.0;
        '';
      };
    };

  testScript = ''
    start_all()
    machine.wait_for_unit("multi-user.target")
    # confirm rasdaemon is running and has a valid database
    # some disk errors detected in qemu for some reason ¯\_(ツ)_/¯
    machine.wait_until_succeeds("ras-mc-ctl --errors | tee /dev/stderr | grep -q 'No .* errors.'")
    # confirm the supplied labels text made it into the system
    machine.succeed("grep -q 'vendor: none' /etc/ras/dimm_labels.d/labels >&2")
    machine.shutdown()
  '';
}