You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
treewide: Replace in-process serial mutex with nextest config
`cargo test` only runs test in parallel within one test module. [`cargo
nextest`] can execute tests in parallel across crates, but in doing so
executes each test in its own process (supposedly for reduced
flakiness). This means our existing in-process mutexes provided by the
`serial_test` crate don't work when running under nextest.
We write our own `#[serial]` procedural macro which, in addition to
adding the same existing in-process mutex from the `serial_test` crate,
also renames tests such that they can be identified by the nextest
filterset DSL. (Although it has a limited ability to parse `cfg` attrs,
there is no facility for inspecting arbitrary attrs attached to the test
or anything like that; otherwise we could just use the existing
`#[serial]` and somehow specify it in the filterset.) This allows
creating [test groups] which don't allow parallel execution within them.
We then get the benefits of parallel test execution across crates; so
for the bulk of the time, 1 test in the mysql group is running and 1
test in the postgres group is running, getting us to (in a simple test
on an M3 Max) 181% CPU usage and a commensurate 81% speedup in clock
time.
```sh
$ time TZ=UTC RUN_SLOW_TESTS=1 cargo nextest run \
-E 'not package(readyset-clustertest)'
...
Summary [ 393.304s] 2667 tests run: 2667 passed, 84 skipped
620.70s user 207.41s system 181% cpu 7:35.10 total
$ time TZ=UTC RUN_SLOW_TESTS=1 cargo test --all \
--exclude readyset-clustertest
...
710.37s user 154.68s system 104% cpu 13:44.92 total
```
[`cargo nextest`]: https://nexte.st/
[test groups]: https://nexte.st/docs/configuration/test-groups/
Change-Id: I75a6b762bb18b4ebe7927cfe60eb7cefea038ee8
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/8507
Tested-by: Buildkite CI
Reviewed-by: Johnathan Davis <[email protected]>
0 commit comments