Repository navigation
Give each live staging test its own pytest worker in the release run - #4127
Merged
Merged
Conversation
run_live_staging_tests.sh runs the 9 live staging tests in two pytest workers, so the step takes about as long as the tests on the busier worker (11.4 minutes in release #2608) rather than the longest test (about 7.4). These tests ask for one worker per collected test, and for the step name that says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
run_live_staging_tests.sh passes -n 9 instead of -n 2, one worker per test, so the step takes about as long as the longest test instead of the tests on the busier worker. The step is renamed to say so. The staging candidate is one Cloud Run instance with a concurrency of 6, and each test sends one request at a time, so at most 3 requests wait at the Cloud Run front end for a free slot. Cloud Run holds a request for the longer of 10 seconds and 3.5 times the average instance startup time, and the tests' client allows 90 seconds per request. The script's comment says this, and asks for -n to be raised, after checking the candidate's capacity, whenever a live test is added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
live-staging-test-workers
branch
from
October 29, 2026 19:52
e615bf3 to
bd67c6e
Compare
anth-volk
force-pushed
the
live-staging-test-workers
branch
from
October 29, 2026 20:13
bd67c6e to
e615bf3
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4127 +/- ##
==========================================
+ Coverage 88.07% 88.13% +0.05%
==========================================
Files 272 273 +1
Lines 16235 16299 +64
Branches 2654 2668 +14
==========================================
+ Hits 14299 14365 +66
+ Misses 1270 1268 -2
Partials 666 666 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4126
Stacked on #4125.
Summary
.github/scripts/run_live_staging_tests.shruns the 9 live staging tests with-n 9instead of-n 2: one pytest worker per test.--dist load --maxschedchunk=1and the test files are unchanged.parallel-live-simulation-tests-staging-cloud-runis renamed "Run live staging tests, one pytest worker per test".test_live_staging_tests_get_one_pytest_worker_each, collects the tests the script selects (pytest --collect-only) and checks that-nequals their number. A new live test therefore fails it until-nis raised with it.Nothing stops being checked; the same tests run against the same candidate.
No inline ruff suppressions are added.
Load on the staging candidate
The candidate is one Cloud Run instance (
CLOUD_RUN_MAX_INSTANCES: "1") that admits 6 requests at a time (CLOUD_RUN_CONCURRENCY6, two gunicorn workers,cloud_run_env.sh). Each test sends one request at a time, so 9 workers can have at most 9 requests in flight, and at most 3 of them wait at the Cloud Run front end for a free slot./us/metadatarequests. After that, the 4 simulation tests send one short status request every 5 seconds while the simulation API computes.docs/migration/cloud-run-operations.md).I chose one worker per test (
-n 9) over a lower count.-n 6would avoid the queueing, but the calculations would still overlap, so the timeout risk would be about the same, and the two longest tests would start up to a minute later.The count is a fixed number, not derived from the number of tests: #4092 adds live test files to this script, and a derived count would raise the load on the one-instance candidate without anyone choosing to.
Job dependencies
Unchanged. Only the step inside
parallel-live-simulation-tests-staging-cloud-runchanges:(Minutes from release #2608.) Expected saving: up to about 4 minutes per release (estimate). In each of the five releases I checked (#2596, #2600, #2602, #2604, #2608), the multi-year budget-window test and the California EITC test finished within 0.2 seconds of each other, on different workers. That suggests they wait on something shared on the staging side, so the saving may be smaller.
Environment variables
None move or change. The job keeps what it had:
API_BASE_URLurlofdeploy-cloud-run-stagingenv:fromneeds.deploy-cloud-run-staging.outputs.urlSTAGING_API_TEST_PROBE_IDtagofdeploy-cloud-run-staging,github.run_idandgithub.run_attempt(event context)env:UV_PYTHON"3.12"env:OLD_SIMULATION_GATEWAY_URLenv:Each pytest worker is its own session, so
integration_probe_idadds a different random suffix in each worker; probe identifiers stay unique.No Google Cloud sign-in in this job, before or after.
Unverified until the first release after merge
push.ymlruns only on pushes tomaster, so this pull request's CI does not run the live tests.Testing
pytest tests/unit/test_cloud_run_push_workflow.py: 2 failed, 14 passed (run_live_staging_tests.sh runs 9 tests in 2 pytest workers, and the step name).test_cloud_run_push_workflow.py,test_alembic_workflows.py,test_app_engine_decommission.py,test_cloud_run_workflow_configuration.py,test_deploy_pipeline_scripts.py,test_locked_test_environments.py,v2/test_metadata_deployment.py,test_policyengine_live_since.py): 106 passed.ruff format --check .andruff check .with the ruff versionuv.lockpins (0.15.12): clean.python scripts/run_quality_guards.py: passed.python -m scripts.rules guard --base-ref origin/master: passed. The rules tool's tests: OK.python -m scripts.rules render: no diff.uv lock --check: passed.shellcheck .github/scripts/run_live_staging_tests.sh: clean.push.ymlparses as YAML and passesactionlint.🤖 Generated with Claude Code