Commit c9021963 authored by Raito Bezarius's avatar Raito Bezarius
Browse files

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

We test that the test framework timeouts are working as expected.
parent a0dc17bd
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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
+15 −0
Original line number Diff line number Diff line
{
  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")
  '';
}