Skip to content

test: deflake test_rendered_helper_spawns_when_health_fails#54

Merged
amitpaz1 merged 1 commit into
mainfrom
fix/lazy-server-test-flake
May 9, 2026
Merged

test: deflake test_rendered_helper_spawns_when_health_fails#54
amitpaz1 merged 1 commit into
mainfrom
fix/lazy-server-test-flake

Conversation

@amitpaz1
Copy link
Copy Markdown
Collaborator

@amitpaz1 amitpaz1 commented May 9, 2026

Summary

The test races a backgrounded `nohup` against the parent script's exit. Production code uses `nohup ... & disown` (correct fire-and-forget); the test's fake `nohup` writes a marker to verify cmdline construction. With sleep shimmed to a no-op, the parent script returns rc=1 in milliseconds while the backgrounded fake nohup may not have run yet — the marker assert sees an empty path.

This bit main CI today as run 25593801334, passing on Python 3.11 / 3.12 / postgres / TS but failing on 3.10. Local: 5/5 passes; rerun on the same commit: success. Pure timing flake, no regression in production code.

Fix: after the bash run, poll for the marker for up to 3s before asserting. Production behavior unchanged.

Test plan

  • `pytest tests/test_lazy_server.py` → 21/21 pass locally
  • `ruff check tests/test_lazy_server.py` clean

🤖 Generated with Claude Code

The production bash spawns ``nohup ... & disown`` — fire-and-forget,
correct behavior. The test's fake ``nohup`` writes a marker file so
the assertion can verify the spawn cmdline was constructed correctly.

But the parent script returns rc=1 from the polling loop in
milliseconds (sleep is a no-op shim) while the backgrounded fake
nohup races to write the marker. On Python 3.10 GitHub runners the
parent regularly wins the race and the test sees a missing marker
even though the production code is correct (run 25593801334 today).

Fix: poll for the marker for up to 3s before asserting. Production
behavior unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@amitpaz1 amitpaz1 merged commit 04c2c94 into main May 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant