Skip to content

Commit

Permalink
speed up nixos tests by having curl timeout faster
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Nov 3, 2024
1 parent 350c953 commit 05d0ac3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions tests/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ test:
pkgs ? import <nixpkgs> { },
...
}@args:
let
inherit (pkgs) lib;
nixos-lib = import (pkgs.path + "/nixos/lib") { };
in
(nixos-lib.runTest {
hostPkgs = pkgs;
(pkgs.testers.runNixOSTest {
# speed-up evaluation
defaults.documentation.enable = lib.mkDefault false;
defaults.documentation.enable = pkgs.lib.mkDefault false;
# Faster dhcp
defaults.networking.useNetworkd = pkgs.lib.mkDefault true;
# to accept external dependencies such as disko
node.specialArgs.inputs = args;
imports = [ test ];
Expand Down
2 changes: 1 addition & 1 deletion tests/t00-simple.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import json
start_all()
client01.wait_until_succeeds("curl -f http://harmonia:5000/version")
client01.wait_until_succeeds("curl --connect-timeout 1 -f http://harmonia:5000")
client01.succeed("curl -f http://harmonia:5000/nix-cache-info")
client01.wait_until_succeeds("nix copy --from http://harmonia:5000/ ${pkgs.hello}")
Expand Down
2 changes: 1 addition & 1 deletion tests/t02-varnish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
testScript = ''
start_all()
client01.wait_until_succeeds("curl -f http://harmonia/version")
client01.wait_until_succeeds("curl --connect-timeout 1 -f http://harmonia/version")
client01.succeed("curl -f http://harmonia/nix-cache-info")
client01.wait_until_succeeds("nix copy --from http://harmonia/ ${pkgs.hello}")
Expand Down
2 changes: 1 addition & 1 deletion tests/t03-chroot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
harmonia.systemctl("start harmonia-dev.service")
harmonia.wait_for_unit("harmonia-dev.service")
client01.wait_until_succeeds("curl -f http://harmonia:5000/version")
client01.wait_until_succeeds("curl --connect-timeout 1 -f http://harmonia:5000/version")
client01.succeed("curl -f http://harmonia:5000/nix-cache-info")
client01.wait_until_succeeds(f"nix copy --from http://harmonia:5000/ {f}")
Expand Down

0 comments on commit 05d0ac3

Please sign in to comment.