redpanda icon indicating copy to clipboard operation
redpanda copied to clipboard

tests: use CTEST_PARALLEL_LEVEL>1 for parallelizing unit tests

Open ivotron opened this issue 4 years ago • 10 comments

This is currently not possible since using anything more than the default (CTEST_PARALLEL_LEVEL=1) causes some tests to fail. Is this fundamentally difficult to achieve (e.g. because of clashes in net/fs/ipc namespaces)?

ivotron avatar Jul 31 '21 01:07 ivotron

Could we farm out duck tape tests to kubernetes?

emaxerrno avatar Jul 31 '21 03:07 emaxerrno

Or some other scheduler. Maybe time to write our own on top of k8s so we can parallelize them ? Might be an interesting research direction

emaxerrno avatar Jul 31 '21 04:07 emaxerrno

This is currently not possible since using anything more than the default (CTEST_PARALLEL_LEVEL=1) causes some tests to fail. Is this fundamentally difficult to achieve (e.g. because of clashes in net/fs/ipc namespaces)?

The fixture tests are parameterised for listener ports, but nearly always use the defaults. Should be a case of making the default a function that allocates any unused port.

I think the filesystem paths are already unique.

BenPope avatar Jul 31 '21 09:07 BenPope

Considering blocking this on https://github.com/vectorizedio/redpanda/issues/2376 (make test runners use faster storage) -- any tests that hit the disk will become significantly less deterministic when they're all competing for the same relatively slow drive in parallel.

jcsp avatar Oct 04 '21 08:10 jcsp

PSA: https://cmake.org/cmake/help/v3.2/prop_test/RUN_SERIAL.html

We could tun on parallel and disable for fixtures. My guess is it won't gain us much, but I mention for posterity.

BenPope avatar Oct 07 '21 00:10 BenPope

Also https://github.com/vectorizedio/redpanda/issues/1970

BenPope avatar Oct 07 '21 00:10 BenPope

@ivotron we didn't consider that as part of optimize redpanda pipeline epic. Should we?

gousteris avatar Aug 03 '22 12:08 gousteris

let's add it as well, if time permits

ivotron avatar Aug 03 '22 15:08 ivotron

Is this fundamentally difficult to achieve (e.g. because of clashes in net/fs/ipc namespaces)?

No, but the tests need some shepherding to make it work.

There are tests (not unit tests really, but things written in C++ that spin up entire redpanda stacks in a single process) that do things like listening on port 9092: those will clash with each other.

Those need to be quarantined from the rest of the true unit tests that can run anywhere anytime. Then the parallelism needs to make sure that those tests don't run in parallel with one another, but that other tests can.

jcsp avatar Aug 09 '22 13:08 jcsp

thanks John. another point that @dotnwat made is that there are some (we counted 7) tests that take ~3mins to execute, because they're bundled in the single binary. if ctest is parallelizing at the level of the binary, then to take advantage of parallel runs we'd need to make sure that those are parallelized well so that they don't run serially, as it'd defeat the purpose of running in parallel

ivotron avatar Aug 09 '22 21:08 ivotron

I did this recently.

jcsp avatar Jan 31 '23 20:01 jcsp

this same optimization now exists in the meson-based test suite

dotnwat avatar Jan 31 '23 23:01 dotnwat