lol

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

We test that the test framework timeouts are working as expected.

+23
+8
nixos/tests/all-tests.nix
··· 90 90 lib-extend = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./nixos-test-driver/lib-extend.nix {}; 91 91 node-name = runTest ./nixos-test-driver/node-name.nix; 92 92 busybox = runTest ./nixos-test-driver/busybox.nix; 93 + driver-timeout = pkgs.runCommand "ensure-timeout-induced-failure" { 94 + failed = pkgs.testers.testBuildFailure ((runTest ./nixos-test-driver/timeout.nix).config.rawTestDerivation); 95 + } '' 96 + grep -F "timeout reached; test terminating" $failed/testBuildFailure.log 97 + # The program will always be terminated by SIGTERM (143) if it waits for the deadline thread. 98 + [[ 143 = $(cat $failed/testBuildFailure.exit) ]] 99 + touch $out 100 + ''; 93 101 }; 94 102 95 103 # NixOS vm tests and non-vm unit tests
+15
nixos/tests/nixos-test-driver/timeout.nix
··· 1 + { 2 + name = "Test that sleep of 6 seconds fails a timeout of 5 seconds"; 3 + globalTimeout = 5; 4 + 5 + nodes = { 6 + machine = ({ pkgs, ... }: { 7 + }); 8 + }; 9 + 10 + testScript = '' 11 + start_all() 12 + machine.wait_for_unit("multi-user.target") 13 + machine.succeed("sleep 6") 14 + ''; 15 + }