Repository navigation
fix(test): wait for /readyz to settle in smoke-test.sh #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,17 +49,27 @@ wait_healthz() { | |
| return 1 | ||
| } | ||
|
|
||
| wait_readyz() { | ||
| for _ in $(seq 1 30); do | ||
| code="$(curl -sS -o /dev/null -w '%{http_code}' "${base}/readyz" 2>/dev/null || echo 000)" | ||
| if [ "${code}" = "200" ]; then return 0; fi | ||
| sleep 1 | ||
| done | ||
| return 1 | ||
| } | ||
|
|
||
| echo "[smoke] waiting for /healthz on ${base}" | ||
| wait_healthz || { echo "[smoke] FATAL: /healthz never became ready" >&2; docker logs "${CTR}" >&2 || true; exit 1; } | ||
| echo "[smoke] PASS /healthz" | ||
|
|
||
| echo "[smoke] checking /readyz" | ||
| code="$(curl -sS -o /dev/null -w '%{http_code}' "${base}/readyz")" | ||
| if [ "${code}" != "200" ]; then | ||
| echo "[smoke] FATAL: /readyz returned ${code} (expected 200)" >&2 | ||
| echo "[smoke] waiting for /readyz on ${base}" | ||
| wait_readyz || { | ||
| code="$(curl -sS -o /dev/null -w '%{http_code}' "${base}/readyz" 2>/dev/null || echo 000)" | ||
| echo "[smoke] FATAL: /readyz returned ${code} after wait (expected 200)" >&2 | ||
|
Comment on lines
+67
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When /readyz becomes 200 during the final Fix: Reuse the last code from 🤖 Prompt for AI agents |
||
| curl -sS "${base}/readyz" >&2 || true | ||
| docker logs "${CTR}" >&2 || true | ||
| exit 1 | ||
| fi | ||
| } | ||
| echo "[smoke] PASS /readyz" | ||
|
|
||
| echo "[smoke] checking negative auth: /v1/catalog without credentials must be rejected" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|| echo 000appends to the code curl already printedwait_readyzsetscode="$(curl ... || echo 000)"; on a failed request curl already writes000, socodebecomes000000and the FATAL line printsreturned 000000instead of the HTTP code. The wait still fails correctly.Fix: Capture with
code="$(curl ... 2>/dev/null)" || code=000in bothwait_readyzand the failure block, so the fallback replaces curl’s own000rather than appending to it.🤖 Prompt for AI agents