Skip to content

Parallelize the unit and integration tests#520

Draft
kmontemayor2-sc wants to merge 13 commits intomainfrom
kmonte/parallel-unit-tests
Draft

Parallelize the unit and integration tests#520
kmontemayor2-sc wants to merge 13 commits intomainfrom
kmonte/parallel-unit-tests

Conversation

@kmontemayor2-sc
Copy link
Collaborator

@kmontemayor2-sc kmontemayor2-sc commented Feb 27, 2026

Scope of work done

Summary

Adds parallel test sharding to CI, splitting Python unit tests and integration tests across 4 Cloud Build shards running concurrently. Slow
test modules are explicitly pinned to specific shards via ordered tuples, preventing hash-collision hotspots. Unpinned modules are assigned via
SHA-256 hash.

  • New run-sharded-cloud-build GitHub Action that launches N parallel Cloud Build jobs (one per shard), streams logs with [shard_N] prefixes,
    and reports pass/fail with build URLs
  • Sharding infrastructure in test_utils.py: _get_shard_for_module() (position-based for pinned, SHA-256 for others), _filter_tests_by_shard(),
    new CLI args --shard_index/--total_shards
  • Pinned module constants in tests/unit/main.py (5 modules, ~88% of runtime) and tests/integration/main.py (8 modules, ~96% of runtime), with
    measured durations as comments
  • CI workflow updates: on-pr-comment.yml and on-pr-merge.yml now use sharded execution with 4 shards, timeout reduced from 120 to 60 minutes
  • Comprehensive tests in test_sharding_test.py: basic sharding (coverage, no-overlap, determinism), pinning behavior, and real-discovery tests
    that scan tests/unit/ to verify sharded == unsharded

As a followup, we should probably move that inlined bash script to be python but then we'd need to add some new ci python deps that we just install for ci purposes and that seems like a different change.

NOTE: I tested this in a slightly different on: push path, I'll test this change when it gets merged and if the ci setup breaks I can revert

Where is the documentation for this feature?: N/A

Did you add automated tests or write a test plan?

Updated Changelog.md? NO

Ready for code review?: NO

@kmontemayor2-sc
Copy link
Collaborator Author

/unit_test_py

@kmontemayor2-sc
Copy link
Collaborator Author

/integration_test

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

GiGL Automation

@ 03:39:24UTC : 🔄 Python Unit Test started.

@ 04:55:30UTC : ✅ Workflow completed successfully.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

GiGL Automation

@ 03:39:30UTC : 🔄 Integration Test started.

@ 05:02:55UTC : ✅ Workflow completed successfully.

@kmontemayor2-sc kmontemayor2-sc changed the title Try to parallelize the unit tests Parallelize the unit and integration tests Feb 27, 2026
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.

2 participants