From 35a4a961db8202df701c10f014ff500da92b21e4 Mon Sep 17 00:00:00 2001 From: Soispha Peetz Date: Thu, 26 Nov 2026 01:17:57 +0100 Subject: tests: Wait for nginx to reload before checking certificate acquisition --- tests/default.nix | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tests/default.nix b/tests/default.nix index 6ab6b5f..b9d741b 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -17,6 +17,13 @@ value = attr.${name}; }; + nodeImports = [ + ./common/acme/client.nix + ./common/dns/client.nix + + ../modules + ]; + vhack.runTest = { name, # Node definition, like in a normal nixos vm test. @@ -24,11 +31,13 @@ # Extra DNS configuration with the node's config as input. # Example: # ``` - # server1 = {config, ...}: { - # "domain.example.org" = { - # TXT = [ "test" ]; - # }; - # }; + # { + # server1 = {config, ...}: { + # "domain.example.org" = { + # TXT = [ "test" ]; + # }; + # }; + # } # ``` # That will add the TXT record to the `domain.example.org` domain, the `config` will # be from the `server1` node. @@ -126,12 +135,7 @@ args.nodes (builtins.mapAttrs (_: _: { - imports = [ - ./common/acme/client.nix - ./common/dns/client.nix - - ../modules - ]; + imports = nodeImports; }) args.nodes) ]; @@ -251,6 +255,9 @@ case ("exited", "dead") | ("exited", "dead") if renewRan: # The unit is done, so it should be good? + # Wait until nginx is up and running again (so nginx has time to reload + # after getting the new certificates.) + host.wait_for_unit("nginx") host.require_unit_state(unitMain, "active") host.succeed(f"${pkgs.lib.getExe pkgs.openssl} s_client -connect {domain}:443 -verify_return_error