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