mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
nixos/tests/iftop: fix non-deterministic failure (#41309)
- make sure machines are fully booted before sending commands - test that capability setting in iftop module makes a difference
This commit is contained in:
parent
6cd5863060
commit
b17b44232f
1 changed files with 9 additions and 5 deletions
|
@ -9,22 +9,26 @@ with lib;
|
||||||
nodes = {
|
nodes = {
|
||||||
withIftop = {
|
withIftop = {
|
||||||
imports = [ ./common/user-account.nix ];
|
imports = [ ./common/user-account.nix ];
|
||||||
|
|
||||||
programs.iftop.enable = true;
|
programs.iftop.enable = true;
|
||||||
};
|
};
|
||||||
withoutIftop = {
|
withoutIftop = {
|
||||||
imports = [ ./common/user-account.nix ];
|
imports = [ ./common/user-account.nix ];
|
||||||
|
environment.systemPackages = [ pkgs.iftop ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
subtest "machine with iftop enabled", sub {
|
subtest "machine with iftop enabled", sub {
|
||||||
$withIftop->start;
|
$withIftop->waitForUnit("default.target");
|
||||||
$withIftop->succeed("su -l alice -c 'iftop -t -s 1'");
|
# limit to eth1 (eth0 is the test driver's control interface)
|
||||||
|
# and don't try name lookups
|
||||||
|
$withIftop->succeed("su -l alice -c 'iftop -t -s 1 -n -i eth1'");
|
||||||
};
|
};
|
||||||
subtest "machine without iftop", sub {
|
subtest "machine without iftop", sub {
|
||||||
$withoutIftop->start;
|
$withoutIftop->waitForUnit("default.target");
|
||||||
$withoutIftop->mustFail("su -l alice -c 'iftop -t -s 1'");
|
# check that iftop is there but user alice lacks capabilities
|
||||||
|
$withoutIftop->succeed("iftop -t -s 1 -n -i eth1");
|
||||||
|
$withoutIftop->fail("su -l alice -c 'iftop -t -s 1 -n -i eth1'");
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue