nixos/tests/nixos-test-driver: test timeout failures

We test that the test framework timeouts are working as expected.
This commit is contained in:
Raito Bezarius 2023-10-27 13:32:04 +02:00
parent a0dc17bd57
commit c90219633c
2 changed files with 23 additions and 0 deletions

View File

@ -90,6 +90,14 @@ in {
lib-extend = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./nixos-test-driver/lib-extend.nix {};
node-name = runTest ./nixos-test-driver/node-name.nix;
busybox = runTest ./nixos-test-driver/busybox.nix;
driver-timeout = pkgs.runCommand "ensure-timeout-induced-failure" {
failed = pkgs.testers.testBuildFailure ((runTest ./nixos-test-driver/timeout.nix).config.rawTestDerivation);
} ''
grep -F "timeout reached; test terminating" $failed/testBuildFailure.log
# The program will always be terminated by SIGTERM (143) if it waits for the deadline thread.
[[ 143 = $(cat $failed/testBuildFailure.exit) ]]
touch $out
'';
};
# NixOS vm tests and non-vm unit tests

View File

@ -0,0 +1,15 @@
{
name = "Test that sleep of 6 seconds fails a timeout of 5 seconds";
globalTimeout = 5;
nodes = {
machine = ({ pkgs, ... }: {
});
};
testScript = ''
start_all()
machine.wait_for_unit("multi-user.target")
machine.succeed("sleep 6")
'';
}