feat(test-runner): support named test locks#41862
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Skn0tt
left a comment
There was a problem hiding this comment.
Nice idea with using locks in the group key!
It's hard to imagine that differentiating between the empty Set and undefined measurably helps. If that was unintended, maybe we can simplify it away.
I'll look at declaring locks on fixtures on top of this.
Tests that share a lock name declared in test details never run concurrently, while all other tests continue to run in parallel. Locks work across files and projects. All locks of a test group are acquired atomically when the job is scheduled and released when it finishes, so locks cannot deadlock, and waiting for a lock does not consume the test timeout. Fixes: microsoft#21484
Fold lock inheritance into the existing bindFileSuiteToProject pass instead of a separate lazy ancestor walk, group tests with an identical lock set into a single job so beforeAll/afterAll hooks run once, and avoid allocations on the scheduling path when no locks are declared.
There is no good reason, simplified. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| // There are 3 kinds of parallel tests: | ||
| // - Tests belonging to parallel suites, without beforeAll/afterAll hooks. | ||
| // These can be run independently, they are put into their own group, key === test. | ||
| // - Tests with locks are grouped by their lock signature instead, key === signature, |
There was a problem hiding this comment.
This rearranges tests based on locks. I am afraid that can have unintended consequences. For example, adding/removing a lock will affect which tests get into which shard. With dynamic locks based on env or something, we might run into problems.
Are we sure this improves scheduling (performance?) in any meaningful way? Why do we think grouping by locks is more beneficial than avoiding the same beforeAll hook running multiple times?
There was a problem hiding this comment.
As discussed offline, reverted changes to the grouping based on lock presence. If it results in an inefficiency in the wild, we'll address it later.
Do not affect test grouping based on locks, drop redundant comments, trim the docs.
Test results for "tests 1"6 flaky50249 passed, 1190 skipped Merge workflow run. |
Test results for "MCP"2 failed 7784 passed, 1262 skipped Merge workflow run. |
|
Hi, I'm the Playwright bot and I took a look at the CI failures. 🟡 Two Firefox/Windows MCP failures — one is a proven flake, the other I can't fully clear (no path from this diff either way)The latest DetailsOverall: This PR ( Pre-existing flake / infra
Uncertain
The Triaged by the Playwright bot. Triaged by the Playwright bot - agent run |
Adds
lock: string | string[]to test details, also available ontest.describegroups.Fixes: #21484