summaryrefslogtreecommitdiffstats
path: root/nixos/tests/irqbalance.nix
blob: 39dbf218ef7d53cc993d0f882221989b12a00aba (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
{ pkgs, lib, ... }:
{
  name = "irqbalance";
  meta.maintainers = with lib.maintainers; [ h7x4 ];

  nodes.machine =
    { config, ... }:
    {
      virtualisation.cores = 2;
      services.irqbalance.enable = true;

      systemd.services.irqbalance.serviceConfig.ExecStart = [
        ""
        "${lib.getExe config.services.irqbalance.package} --journal --debug"
      ];
    };

  testScript = ''
    machine.wait_for_unit("irqbalance.service")

    machine.wait_until_succeeds("journalctl -u irqbalance.service --grep='Package 0'")

    unmanaged_irq_count = machine.succeed("journalctl -u irqbalance.service -o cat --grep 'affinity is now unmanaged' | sort -u | wc -l")

    # The number of unmanaged IRQs is not entirely stable, but there is likely something
    # wrong if any more that 2 queues are unmanaged
    assert int(unmanaged_irq_count) <= 2
  '';
}