Skip to content

Make tests independent from each other to be able to run in parallel #229

@leandro-lucarella-frequenz

Description

What's needed?

To speed up tests run, there is pytest-xdist, which lets you run tests in parallel.

But right now we can't do that because we are using some gRPC mock server that actually serves connection and when multiple tests using this run at the same time, they will share the same server and conflict.

Proposed solution

Ideally stop using the gRPC mock server and just use regular python mocks instead. If not possible maybe consider isolating the servers used in different tests or see if there is a way to declare tests dependency.

Use cases

No response

Alternatives and workarounds

No response

Additional context

With 8 cores and using 12 workers (using less workers still doesn't saturate the CPUs, I guess tests have too much wait time), tests run in 10s, while without parallelization they take 28s.

This means that when running nox, we should be able to go from 1 minutes to 20s!

Metadata

Metadata

Assignees

No one assigned

    Labels

    part:testsAffects the unit, integration and performance (benchmarks) testspriority:lowThis should be addressed only if there is nothing else on the tabletype:tech-debtImproves the project without visible changes for users

    Type

    No type

    Projects

    Status

    To do

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions