Repository navigation
Keep the release test split's settings out of pytest runs that tests start - #4140
Merged
Merged
Conversation
…start Release run 41063091599 failed on shard 6 of 6: a test that runs pytest itself inherited PYTEST_ADDOPTS and the RELEASE_TEST_SHARD_* variables, so the shard plugin split that inner run's tests too and kept none of them. The new tests run a shard the way run_release_tests.sh does, with a test that starts its own pytest process, and check that a shard's report can't be written twice. Both fail until the plugin and write_report are fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…start The shard plugin now reads RELEASE_TEST_SHARD_INDEX, _COUNT and _REPORT_DIRECTORY once, in pytest_configure, and then removes them and its own -p option from PYTEST_ADDOPTS in the process environment. A pytest process that a test starts, as test_live_staging_tests_get_one_pytest_worker_each does, therefore collects its tests without the split instead of deselecting them, and can't replace the shard's report. write_report now refuses to replace an existing report, so any second writer fails loudly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ests test_live_staging_tests_get_one_pytest_worker_each counted the live staging tests by starting its own pytest process, which is what made release run 41063091599 fail on shard 6. The worker count in run_live_staging_tests.sh is now kept in step with the live tests by hand; the script's comment says to raise -n when adding a test. The other live staging step checks stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4140 +/- ##
===========================================
+ Coverage 50.63% 88.15% +37.52%
===========================================
Files 258 274 +16
Lines 14955 16393 +1438
Branches 2399 2689 +290
===========================================
+ Hits 7573 14452 +6879
+ Misses 6751 1271 -5480
- Partials 631 670 +39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was previously 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 #4139
Summary
The first release run with the split release test suite (#4134), run 41063091599, failed on shard 6 of 6, so no deploy job ran.
run_release_tests.shturns the split on withPYTEST_ADDOPTS="-p tests.release_test_shard_plugin"and the threeRELEASE_TEST_SHARD_*variables.test_live_staging_tests_get_one_pytest_worker_eachstarts its ownpytest --collect-onlyon the two live staging test files, and that process inherited all four, so the plugin ran inside it too: it split just those two files over six shards, kept none on shard 6, and pytest exited with "no tests collected (9 deselected)". The plugin writes the shard's report when it collects, so the inner run also replaced the shard's report; on shards where the inner run kept its tests,check-release-test-shardswould have failed instead.tests/release_test_shard_plugin.py: reads its settings once, inpytest_configure, keeps them in the config stash, then removesRELEASE_TEST_SHARD_INDEX,RELEASE_TEST_SHARD_COUNT,RELEASE_TEST_SHARD_REPORT_DIRECTORYand its own-poption (both the-p nameand-pnameforms) fromPYTEST_ADDOPTSinos.environ. Any otherPYTEST_ADDOPTSoptions are kept. A missing or invalid setting still stops the run with the same message.scripts/release_test_shards.py:write_reportcreates the shard file with exclusive creation and raisesFileExistsErrorif a report is already there, so a second writer fails loudly instead of replacing a shard's report.tests/unit/test_cloud_run_push_workflow.py: removestest_live_staging_tests_get_one_pytest_worker_eachand its two helpers. It counted the live staging tests by starting its own pytest process, which is what failed on shard 6.run_live_staging_tests.sh's comment now says a new live test needs-nraised with it; the other checks of the live staging step stay.docs/engineering/skills/testing.md: says how the plugin keeps its settings from pytest runs that tests start.Red and green
91f4afa0dTest that the release test split stays out of pytest runs that tests startRELEASE_TEST_SHARD_*variables, and a secondwrite_reportdoes not raise9cb894439Keep the release test split's settings out of pytest runs that tests startaa6f14a5bRemove the test that the live staging worker count matches the live testsThe new end-to-end test runs every shard the way
run_release_tests.shdoes (plugin loaded throughPYTEST_ADDOPTS), with a sample test that starts its own pytest process on files the outer run doesn't collect, then runscheck-coverageover the reports.Environment variables
No workflow or script changes. The variables the plugin now removes after reading:
RELEASE_TEST_SHARD_INDEXpush.ymlrelease-tests matrix (matrix.shard_index)env:of "Run release tests"RELEASE_TEST_SHARD_COUNT"6"inpush.ymlenv:RELEASE_TEST_SHARD_REPORT_DIRECTORYrunner.tempinpush.ymlenv:PYTEST_ADDOPTS.github/scripts/run_release_tests.shformake testmake testRemoving them affects only the pytest process that already read them and the processes its tests start. The upload step after
make teststill reads the report directory from its own${{ runner.temp }}expression, not from the environment.Testing
ruff format --checkandruff check(locked ruff 0.15.12) on the three changed Python files: clean.python scripts/run_quality_guards.py: all guards passed.python -m scripts.rules guard --base-ref origin/master: passed.python -m scripts.rules render: no diff.noqa(96 before and after).Unverified until the next release run: that all six shards and
check-release-test-shardspass on the real suite, and that the deploy jobs then run after the skipped checks.🤖 Generated with Claude Code