nixos/vnstat: add NixOS test

This commit is contained in:
Henri Menke
2026-07-16 15:42:23 +02:00
parent 6d3c620fa6
commit 4b1a16ac0b
3 changed files with 30 additions and 0 deletions
+1
View File
@@ -1844,6 +1844,7 @@ in
};
virtualbox = handleTestOn [ "x86_64-linux" ] ./virtualbox.nix { };
vm-variant = handleTest ./vm-variant.nix { };
vnstat = runTest ./vnstat.nix;
vscode-remote-ssh = handleTestOn [ "x86_64-linux" ] ./vscode-remote-ssh.nix { };
vscodium = import ./vscodium.nix { inherit runTest; };
vsftpd = runTest ./vsftpd.nix;
+26
View File
@@ -0,0 +1,26 @@
{ lib, ... }:
{
name = "vnstat";
meta.maintainers = with lib.maintainers; [ hmenke ];
containers.machine = {
services.vnstat = {
enable = true;
settings = {
AlwaysAddNewInterfaces = 1;
};
};
};
testScript = ''
start_all()
machine.wait_for_unit("vnstat.service")
machine.succeed("vnstat --iflist")
machine.fail("vnstat -i dummy0")
machine.succeed("ip link add dummy0 type dummy")
machine.succeed("ip link set dummy0 up")
machine.wait_until_succeeds("vnstat -i dummy0", timeout=10)
'';
}
+3
View File
@@ -7,6 +7,7 @@
ncurses,
sqlite,
check,
nixosTests,
}:
stdenv.mkDerivation (finalAttrs: {
@@ -40,6 +41,8 @@ stdenv.mkDerivation (finalAttrs: {
doCheck = true;
passthru.tests = { inherit (nixosTests) vnstat; };
meta = {
description = "Console-based network statistics utility for Linux";
longDescription = ''