Skip to content

chore: add test sharding to unit tests#17438

Open
daniel-sanche wants to merge 86 commits into
mainfrom
ci_sharding
Open

chore: add test sharding to unit tests#17438
daniel-sanche wants to merge 86 commits into
mainfrom
ci_sharding

Conversation

@daniel-sanche

@daniel-sanche daniel-sanche commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Added test sharding for unit tests:

  • added initialize job to unit test CI. It analyzes the modified packages, and spawns up to MAX_SHARDS jobs for each supported Python runtime
  • long-running packages can have a multiplier added in PACKAGE_WEIGHTS. This will cause the system to reserve more time for long-running tests, to better distribute the workload across shards
  • shards are added according to the formula `shards_used = min(1, max(MAX_SHARDS, total_package_weight / 10))
  • adds an end unit test complete step, which is only green if all shards pass. This can be our new required check for unit tests
  • if any single unit test shard fails, the remaining end early to provide quick feedback

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces parallel execution for system tests and implements a sharding mechanism for CI jobs, including a new Python script to group packages and updates to the test runner script. Feedback on these changes focuses on improving reliability and safety: first, by using an EXIT trap in .kokoro/system.sh to guarantee cleanup of isolated gcloud configuration directories in case of test failures; and second, by avoiding global toggles of set -e in ci/run_conditional_tests.sh and instead capturing test exit codes using the || operator.

Comment thread .kokoro/system.sh Outdated
Comment thread .kokoro/system.sh Outdated
Comment thread ci/run_conditional_tests.sh Outdated
@daniel-sanche daniel-sanche changed the title [DRAFT] chore: add test sharding [DRAFT] experiment: add test sharding Jun 12, 2026
daniel-sanche and others added 5 commits July 6, 2026 22:02
Updated the unittest workflow to include coverage installation and combine coverage results for better reporting.
@daniel-sanche daniel-sanche marked this pull request as ready for review July 7, 2026 21:01
@daniel-sanche daniel-sanche requested review from a team as code owners July 7, 2026 21:01
@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 7, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 7, 2026
@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 7, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the Firestore API. unit_test:all_packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants