Repository navigation
test(mock-anthropic): wait up to 30 s for the mock, and stop with its stderr if it never listens - #828
Conversation
… stderr if it never listens The test waited 5 s (50 x 0.1 s) for the mock's 'listening' line. On a busy CI runner, node's cold start outlasted that twice (rossoctl#760, rossoctl#772). The port then stayed empty, and every later check ran curl against port 80, failing 80-odd checks with nothing about the cause. Wait up to 30 s, stop early if the mock exits, and when it never listens fail once with its stderr. Closes rossoctl#826 Assisted-By: Claude Code Signed-off-by: Rong Chang <[email protected]>
clawgenti
left a comment
There was a problem hiding this comment.
Summary
Clean fix for #826: the mock wait goes from ~5 s to up to 30 s, stops early when the mock process dies (kill -0), and — the part that matters most — when the port is never read the test now fails once with the mock's stderr instead of running 80-odd checks against curl's port-80 fallback. The checks themselves are untouched.
The loop, the early-exit and the stderr dump are all straightforward; shellcheck and the bash 3.2 CI job cover the portability concerns. No findings.
Author: webchang (MEMBER — maintainer)
Areas reviewed: Shell, Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (deploy-scripts jobs pending at review time)
All checks pass. Ready for human review.
Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).
clawgenti
left a comment
There was a problem hiding this comment.
State marker for the review queue (full review posted separately on this SHA):
Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Approving. The 30 s wait with a kill -0 early exit fixes the cold-start flake in #826. Stopping with the mock's stderr when no port was read replaces the 80-odd cascading FAILs with the actual cause. The EXIT trap still cleans up on the new early exit, and the change is bash 3.2-clean.
Author: webchang (MEMBER, maintainer)
Areas reviewed: Shell (deploy test)
Agent/IDE config (.claude/.vscode): none
Commits: 1, all signed off: yes
CI status: passing
Takes upstream main at 1a7f41e (19 merges since 032c8f6): the sandbox idle lifetime across docs, control plane, clients and deploy (rossoctl#820, rossoctl#837, rossoctl#842, rossoctl#843), grant redemption (rossoctl#822), the lease-check log line (rossoctl#824), egress fixes (rossoctl#829, rossoctl#834), the mock wait (rossoctl#828), the deadline timer (rossoctl#835), the create rollback (rossoctl#832), multi refusals and the rossoctl#363 leftovers (rossoctl#833, rossoctl#838), the identity near-miss check (rossoctl#827), mocactl login errors (rossoctl#836), the ghostunnel probes (rossoctl#830), refusal-burst deferral (rossoctl#831), a sandbox-worker change (rossoctl#841) and the v0.11 doc truth (rossoctl#821). Conflicts (one): - deploy/sbx/README.md, the "Optional inputs" table. Upstream (rossoctl#843) rewrote the SBX_LIFETIME_DAYS row (the default idle lifetime, at most SBX_MAX_LIFETIME_DAYS) and added the SBX_MAX_LIFETIME_DAYS and SBX_LOWER_WORKSPACE_IDLE rows, which widened the table; the fork had added an SBX_GATE_RECORD_SCHEMA row at its end. Resolved by taking upstream's table whole and appending the fork's SBX_GATE_RECORD_SCHEMA row after SBX_PROFILE, then re-padding the table with prettier. The fork's env-file example line for SBX_GATE_RECORD_SCHEMA merged cleanly. Merged without markers, checked: setup.sh keeps the fork's SBX_GATE_RECORD_SCHEMA validation and its sbx-settings write (so it stays in the settings hash) beside upstream's SH_SANDBOX_MAX_LIFETIME_SECONDS; both ocp-sbx and ocp-combined patch-control-plane.yaml keep the optional SH_GATE_RECORD_SCHEMA from sbx-settings beside the new optional SH_SANDBOX_MAX_LIFETIME_SECONDS; setup.test.sh keeps the fork's cases beside upstream's. The fork's RUNBOOK, README and template-onboarding docs say nothing about sandbox lifetime, refusal bursts, login errors or the create rollback, so none needed a correction; GUIDE.md is unchanged and GUIDE.pdf is not regenerated. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Closes #826
What changed and why
deploy/microvm/tests/mock-anthropic.test.shwaited at most 5 s (50 x sleep 0.1) for the mock'slisteningline. In feat(control-plane): keep sandbox templates in a store, with builds, tags, readiness and a read API #760's and feat(control-plane,sbx): a template host agent builds queued templates; builds register by policy #772's failing runs, the first FAIL came 5.2 s after the test started: node had not printed the line yet. The port then stayed empty, so every latercurlwent tohttp://127.0.0.1:/…(port 80), and the run ended with 80-odd FAILs and nothing about the cause.kill -0).Validation
With a
nodewrapper first on thePATH:listening on loopbackfirst, thencurl: (7) … port 80, as in CIPASS(15 s)the mock is not listening; its stderr:and the message; exit 1 within 1 sPASSPASS(A 6 s start still passed on main on this machine, because each
sleep 0.1there takes longer than 0.1 s. So the old wait was a little over 5 s of real time, as the CI timings show.)/bin/bash3.2 (CI'sdeploy-scripts-bash32).shellcheck -S warning(shellcheck-py 0.10.0.1) is clean, and pre-commit passes.Every commit is signed off (DCO).
Assisted-By: Claude Code