From 7f9ea915ff561518a1b21899bda0596e4c0f952a Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Sat, 15 Feb 2025 09:59:40 +0700 Subject: [PATCH] nixosTests.step-ca: wait for caddy to finish ACME dance On my machine, I see that this `curl` command often fails. This is because the caddy server hasn't finished the ACME dance with the step-ca server yet. This seems like the simplest fix. Alternatives I considered (and would be happy to implement if folks prefer): - Use `wait_for_file` to wait for the certificate to appear - Increase caddy's log level and scrape its logs for the "certificate obtained" message. --- nixos/tests/step-ca.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nixos/tests/step-ca.nix b/nixos/tests/step-ca.nix index 68364e278d56..67beacf7a49e 100644 --- a/nixos/tests/step-ca.nix +++ b/nixos/tests/step-ca.nix @@ -95,6 +95,10 @@ import ./make-test-python.nix ({ pkgs, ... }: catester.succeed("curl https://caclient/ | grep \"Welcome to nginx!\"") caclientcaddy.wait_for_unit("caddy.service") - catester.succeed("curl https://caclientcaddy/ | grep \"Welcome to Caddy!\"") + + # It's hard to know when caddy has finished the ACME + # dance with step-ca, so we keep trying to curl + # until succeess. + catester.wait_until_succeeds("curl https://caclientcaddy/ | grep \"Welcome to Caddy!\"") ''; })