Running integration tests in parallel

I have a project which has more than 10-15 modules. I have split the tests in a way such that the unit tests are run separately and the integration tests are run separately. The unit tests can be easily parallelized. But the integration tests need a custom backend to run against and no two modules can run against the same backend.

I have the ability to provision multiple backends. The thing I am trying to achieve is to run the integration tests in parallel and ensure that all the different parallel modules hit different backends. Is there a way to specify the backends to the different tasks spawned such that each worker only talks to one backend?

Assumptions :

  1. max_workers = 2/3 (defined through the command line arguments)
  2. forkEvery is not set.
  3. maxParallelFork = 1 (so that each module only runs in one worker)

Ideally, I would like the following :

  1. Specify a list of backends which is equal to the number of max-workers flag.
  2. On starting a task, I pick one of the backends from the list specified and set it as the system property for the given worker.
  3. The worker uses the backend from the system properties to run the tests.

The guarantees that I need to provide are:

  1. No two workers are going to hit the same backend.
  2. All the backends are going to be used (to improve effeciency)