test(deployments): keep the image pull out of the observe-wait timing window - #989
test(deployments): keep the image pull out of the observe-wait timing window#989SandyChapman wants to merge 1 commit into
Conversation
… window test_never_deployment_outlives_observe_wait_then_succeeds asserts that create_deployment returns within observe_timeout + 2.0s. It pre-pulls alpine:3.20 with a comment saying this keeps an uncached pull out of the timed window, but that is not what happens: the backend is built with pull_images=True, and create_deployment pulls unconditionally rather than only when the image is missing locally. The warm-up avoids re-downloading layers; it does nothing about the registry round-trip, which still lands inside the measurement. A fully cached alpine:3.20 pull measures ~1.7s locally, so the unfixed test runs at 2.85s against a 3.0s budget on a fast machine with a warm cache -- 0.15s of margin, all of it hostage to Docker Hub latency. CI has been tipping over it on main and on unrelated branches: run 30554298719 (main) 4.39s run 30550043391 (PR #987) 3.84s run 30549563915 (experimentalist-run-progress) 3.42s Build the backend with pull_images=False so the test's own pre-pull is what puts the image on the host, and the timed window covers container create, start, and the observe wait -- what the assertion is actually about. Measured 1.18s across three runs afterwards, stable, with 1.82s of headroom. This only changes the one helper used by that test; the other three tests in the file keep the default pull_images=True. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Sandy Chapman <schapman@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Docker observe-timeout test now sets ChangesDocker observe-timeout testing
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
|
Superseded by #987, which now carries this commit. #987 and this PR were blocking each other: #987 fixes the daemon-lifecycle flake but was failing on the docker flake (deterministic, 4/4 runs), while this PR fixes the docker flake but failed on the daemon-lifecycle flake. Neither could go green alone, so both fixes now live on #987. The fix here was validated in CI on this PR's run — the docker test passed and dropped off the slowest-25 durations. Cherry-picked verbatim to |
What
test_never_deployment_outlives_observe_wait_then_succeedsasserts thatcreate_deploymentreturns withinobserve_timeout + 2.0s. It pre-pullsalpine:3.20with a comment saying this keeps an uncached pull out of the timed window — but that is not what happens.The backend is built with
pull_images=True, andcreate_deploymentpulls unconditionally rather than only when the image is missing locally. The warm-up avoids re-downloading layers; it does nothing about the registry round-trip, which still lands inside the measurement.Why now
A fully cached
alpine:3.20pull measures ~1.7s locally. That puts the unfixed test at 2.85s against a 3.0s budget on a fast machine with a warm cache — 0.15s of margin, all of it hostage to Docker Hub latency. CI has been tipping over it onmainand on unrelated branches:create_elapsedmainfix-stop-instance-lock-race/schapman(#987)feat/experimentalist-run-progressThere is no
@pytest.mark.flakyon this test — reruns are opt-in per-test in this repo — so a single slow pull is a hard CI failure on whatever PR happens to be running.The fix
Build the backend with
pull_images=Falsein_docker_backend_with_observe_timeout, so the test's own pre-pull is what puts the image on the host and the timed window covers container create, start, and the observe wait — what the assertion is actually about.The helper is used only by this test; the other three tests in the file keep the default
pull_images=True.Verification
Measured
create_elapsedlocally, 3 runs each:Full
test_docker_backend.py: 4 passed.ruff check/ruff format --checkclean;tools/lint/lint-python-types.shexits 0 with this file unimplicated;lint-copyright-headers,lint-merge-conflict,lint-no-nmp-common-in-pluginspass.Out of scope
pull_imagesis described as "Pull container images before run when missing locally", but the implementation pulls unconditionally. That mismatch is real and worth a look, but changing it alters production pull behaviour for mutable tags, so it does not belong in a test-flake fix.🤖 Generated with Claude Code
Summary by CodeRabbit