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