Skip to content

Commit 1f36735

Browse files
6RUN0claude
andcommitted
test(smoke): poll the control socket for the certificate check
After the post-config daemon restart Unit's controller (which serves the control socket) can come up a moment after the router that already answered the HTTP request, so a single probe of /certificates/<name> was racy and failed intermittently on CI runners (8.4/8.5 red, 8.3 green by luck). Poll for up to 30s, mirroring the HTTP readiness wait above. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9ff0321 commit 1f36735

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

test/smoke.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,23 @@ fi
175175
echo "==> *.sh executed (marker: $script_out)"
176176

177177
# *.pem: assert the entrypoint uploaded the bundle, visible via the control API.
178+
# The control socket is served by Unit's controller, which after the post-config
179+
# daemon restart can come up a moment later than the router that already answered
180+
# the HTTP request above, so poll instead of probing once (otherwise flaky on a
181+
# slow runner).
178182
if [ -n "$cert_check" ]; then
179183
echo "==> verifying the entrypoint uploaded the *.pem certificate bundle"
180-
if ! docker exec "$CONTAINER" curl -fsS -o /dev/null \
181-
--unix-socket /var/run/control.unit.sock \
182-
"http://localhost/certificates/$CERT_NAME" 2>/dev/null; then
184+
cert_ok=
185+
for _ in $(seq 1 30); do
186+
if docker exec "$CONTAINER" curl -fsS -o /dev/null \
187+
--unix-socket /var/run/control.unit.sock \
188+
"http://localhost/certificates/$CERT_NAME" 2>/dev/null; then
189+
cert_ok=1
190+
break
191+
fi
192+
sleep 1
193+
done
194+
if [ -z "$cert_ok" ]; then
183195
echo "FAIL: certificate '$CERT_NAME' not retrievable from the control API" >&2
184196
echo "---- container logs ----" >&2
185197
docker logs "$CONTAINER" >&2 || true

0 commit comments

Comments
 (0)