diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 398fa4157388..fa24b7e6aa23 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -765,6 +765,7 @@ in invoiceplane = runTest ./invoiceplane.nix; iodine = runTest ./iodine.nix; ipv6 = runTest ./ipv6.nix; + irqbalance = runTest ./irqbalance.nix; iscsi-multipath-root = runTest ./iscsi-multipath-root.nix; iscsi-root = runTest ./iscsi-root.nix; isso = runTest ./isso.nix; diff --git a/nixos/tests/irqbalance.nix b/nixos/tests/irqbalance.nix new file mode 100644 index 000000000000..39dbf218ef7d --- /dev/null +++ b/nixos/tests/irqbalance.nix @@ -0,0 +1,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 + ''; +} diff --git a/pkgs/by-name/ir/irqbalance/package.nix b/pkgs/by-name/ir/irqbalance/package.nix index 926001b76e8c..c08ce227b29e 100644 --- a/pkgs/by-name/ir/irqbalance/package.nix +++ b/pkgs/by-name/ir/irqbalance/package.nix @@ -9,6 +9,7 @@ libcap_ng, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal, systemdMinimal, + nixosTests, }: stdenv.mkDerivation rec { @@ -48,6 +49,8 @@ stdenv.mkDerivation rec { --replace-fail ' $IRQBALANCE_ARGS' "" ''; + passthru.tests.nixos = nixosTests.irqbalance; + meta = { homepage = "https://github.com/Irqbalance/irqbalance"; changelog = lib.strings.optionalString (