-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
tests(smokehouse): add flag for test sharding #13047
Conversation
It's being used to count things and we humans start at 1, and starting at zero is only necessary to help computers squeeze performance out of adding offsets to memory locations so... 1 sgtm :) |
# The total number of shards. Set dynamically when length of single matrix variable is | ||
# computable. See https://github.community/t/get-length-of-strategy-matrix-or-get-all-matrix-options/18342 | ||
SHARD_TOTAL: 2 |
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 unfortunately really annoying. You can get the length of the entire matrix with ${{ strategy.job-index }}
, but that's 4 here, not 2 (since it's chrome-channel
× smoke-test-shard
).
There are also ways you can do fancy things with | jq '. | length'
, but you need a reference to the whole array first, so you need it to be the output of another job (can't do it with env
because they aren't available inside matrix
...), at which point it all becomes much more verbose than just having a 2
here.
So... :/
* Parses the cli `shardArg` flag into `shardNumber/shardTotal`. Splits | ||
* `testDefns` into `shardTotal` shards and returns the `shardNumber`th shard. | ||
* Shards will differ in size by at most 1. | ||
* Shard params must be 1≤shardNumber≤shardTotal. |
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.
here and elsewhere: can you break up with spaces, hard to read. 1 ≤ shardNumber ≤ shardTotal
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.
good call
c7ebc25
to
c55b22b
Compare
Adds an easier way to split up smoke tests across multiple runners with a
--shard=n/d
flag, which splits the requested tests up intod
shards and runs then
th shard.This stacks with the existing test selection and
--invert-match
functionality, so e.g.yarn smoke seo --shard=1/2
will runseo-passing seo-failing
(out of all theseo
testsseo-passing seo-failing seo-status-403 seo-tap-targets
), and similarlyyarn smoke --invert-match forms --shard=1/4
will run the first fourth of all the smoke tests excludingforms
.Both FR and the smoke bundle now run almost all of the smoke tests so are taking longer and we may want to split them up, but the
--invert-match
trick won't work to split them up into multiple runners because they need--invert-match
to disallow certain tests. We may also eventually want to split up the smoke tests into more than two jobs, which--invert-match
also wouldn't handle.I got the flag naming from
playwright
'sshard
(similar flags exist elsewhere but this was the most recent inspiration). Also the reason for using 1 as the lowest shard number instead of 0...not sure how other people feel about that :)