Skip to content

ci: shard Go tests and parallelize CDP suite - #177

Open
pr4bh4sh wants to merge 1 commit into
devicelab-dev:mainfrom
pr4bh4sh:ci/shard-go-tests
Open

pr4bh4sh wants to merge 1 commit into
devicelab-dev:mainfrom
pr4bh4sh:ci/shard-go-tests

Conversation

@pr4bh4sh

@pr4bh4sh pr4bh4sh commented Sep 25, 2026 •

Copy link
Copy Markdown

Summary

  • Split the Go test suite into four static matrix shards (cdp, s1, s2, s3).
  • Keep race detection on the fast shards and run the CDP shard with bounded -parallel 4.
  • Mark independent CDP browser tests parallel so they can run concurrently.
  • Upload each shard coverage file under the same Codecov flag and report name so Codecov combines them into one report.

Validation

  • go test ./... -run '^$'
  • go test ./pkg/driver/browser/cdp -parallel 4 -timeout 25m -coverprofile=coverage-cdp.out -covermode=atomic — passed in 3m 06s with 80.9% coverage
  • Workflow YAML parsing and matrix package-completeness check
  • gofmt and git diff --check

Related tracking issue: pr4bh4sh#9

@codecov

codecov Bot commented Sep 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@omnarayan

Copy link
Copy Markdown
Contributor

Thanks @pr4bh4sh, nice work. I approved the workflow run and it's all green:

Job Time
shard s1 3m 22s
shard cdp 3m 06s
shard s2 2m 37s
shard s3 1m 12s
CI total 3m 44s (was ~8.5–9 min on main)

I also ran the CDP package locally with -parallel 4: it passed in 160s, and none of the tests call newTestDriver twice or use t.Setenv, so the t.Parallel() in the helper is safe.

One request before merging: since the shard package lists are static, could you add a step that fails CI when a package isn't covered by any shard? Otherwise a package added later would silently never be tested. Something like:

go list ./... | sort > all.txt
printf '%s\n' <all shard package lists> | tr ' ' '\n' | sort -u > sharded.txt
diff -u all.txt sharded.txt

A small nit, optional: -parallel "$CDP_PARALLEL" applies to every shard, not only CDP. It's harmless, but a neutral name like TEST_PARALLEL would read better.

Happy to merge once the coverage check is in.

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