at 23.11-pre 975 B view raw
1import ./make-test-python.nix ({ pkgs, lib, ... }: 2 3{ 4 name = "iftop"; 5 meta.maintainers = with lib.maintainers; [ ma27 ]; 6 7 nodes = { 8 withIftop = { 9 imports = [ ./common/user-account.nix ]; 10 programs.iftop.enable = true; 11 }; 12 withoutIftop = { 13 imports = [ ./common/user-account.nix ]; 14 environment.systemPackages = [ pkgs.iftop ]; 15 }; 16 }; 17 18 testScript = '' 19 with subtest("machine with iftop enabled"): 20 withIftop.wait_for_unit("default.target") 21 # limit to eth1 (eth0 is the test driver's control interface) 22 # and don't try name lookups 23 withIftop.succeed("su -l alice -c 'iftop -t -s 1 -n -i eth1'") 24 25 with subtest("machine without iftop"): 26 withoutIftop.wait_for_unit("default.target") 27 # check that iftop is there but user alice lacks capabilitie 28 withoutIftop.succeed("iftop -t -s 1 -n -i eth1") 29 withoutIftop.fail("su -l alice -c 'iftop -t -s 1 -n -i eth1'") 30 ''; 31})