-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Run tests in parallel jobs #4076
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
482256a
to
ab9b4b0
Compare
ab5c974
to
355b7dd
Compare
Hey, I really appreciate your work here! At the same time, is the runtime of the tests dominated by running the tests themselves or is the runtime dominated by all the cache loading/compiling that has to happen before? If the test time dominates then splitting the tests makes sense. If not... |
It seems that listing (or rather building test binaries) takes around 1 minute. Remaining 5-6 minutes is test execution. My goal here is to reduce test jobs run time to about 3 minutes, then they will be on par with other CI jobs. This should save another 3 minutes for workflow completion on PRs and releases. |
Thank you! The testscript tests are very I/O heavy. If there's a way to run them on a ramdisk, it might be a significant win. |
5e09d30
to
7946fad
Compare
I tried in 7946fad but there is absolutely no difference unfortunately. Maybe it's already a ramdisk. |
d94d8e6
to
b959f39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very clever. The only question I have is whether the test scripts are "balanced" in the way you segmented them (0-9a-h and i-z). I suspect that it doesn't matter much because there's not that many, and it wouldn't be too hard to make more slices if the number of test scripts increases.
The runtime of jobs is pretty close as you can see. Mac jobs are the slowest now, it's pretty easy to split them into 3 parts if needed. |
7797454
to
0ca0c80
Compare
So this should save additional 4 minutes on every PR and release CI, sounds pretty good. |
Brilliant, thank you! |
Changes
-filter
flag toTestScript
which allows to filter scripts by filename using regex. This can be useful for tests sharding and running individual test locally.go test -short
runs all tests exceptTestScript
.test-index: 0
runs./... -short
andTestScript
tests^[a-h]
test-index: 1
runTestScript
remaining tests^[i-z]
test-index: 0
runs./... -short
andTestScript
tests^[a-d]
test-index: 1
runTestScript
remaining tests^[e-i]
test-index: 2
runTestScript
remaining tests^[j-z]
Results
And this is where we started: 22m55s, 78% improvement!