nixos/iftop: port test to python test-driver

This commit is contained in:
Maximilian Bosch 2019-11-26 22:29:27 +01:00
parent ec0590c566
commit 88a40abc92
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
1 changed files with 12 additions and 13 deletions

View File

@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, lib, ... }: import ./make-test-python.nix ({ pkgs, lib, ... }:
with lib; with lib;
@ -18,17 +18,16 @@ with lib;
}; };
testScript = '' testScript = ''
subtest "machine with iftop enabled", sub { with subtest("machine with iftop enabled"):
$withIftop->waitForUnit("default.target"); withIftop.wait_for_unit("default.target")
# limit to eth1 (eth0 is the test driver's control interface) # limit to eth1 (eth0 is the test driver's control interface)
# and don't try name lookups # and don't try name lookups
$withIftop->succeed("su -l alice -c 'iftop -t -s 1 -n -i eth1'"); withIftop.succeed("su -l alice -c 'iftop -t -s 1 -n -i eth1'")
};
subtest "machine without iftop", sub { with subtest("machine without iftop"):
$withoutIftop->waitForUnit("default.target"); withoutIftop.wait_for_unit("default.target")
# check that iftop is there but user alice lacks capabilities # check that iftop is there but user alice lacks capabilitie
$withoutIftop->succeed("iftop -t -s 1 -n -i eth1"); withoutIftop.succeed("iftop -t -s 1 -n -i eth1")
$withoutIftop->fail("su -l alice -c 'iftop -t -s 1 -n -i eth1'"); withoutIftop.fail("su -l alice -c 'iftop -t -s 1 -n -i eth1'")
};
''; '';
}) })