Hello :wave: I'm wondering if there is any way to...
# general
Hello 👋 I'm wondering if there is any way to configure a particular
target to to run in series? Using pants 2.7
👋 2
Use case: I'm attempting to introduce pants to an existing repository, which has a test suite relying on
to bring up a backing service which the tests share (not unlike a test database in Django). Obviously if this happens for all tests, there may be port conflicts etc. In the ideal world, the tests would be independent, but I'm wondering if there's any way to sacrifice parallelism as a workaround.
If you can tolerate having
docker instances running where
is the number of concurrent executions, you can use the
execution_slot_var = "PANTS_EXECUTION_SLOT"
config value to broker tests between the different docker instances. This how we handle boostrapping multiple copies of the DB when running tests in a parallel environemt. Basically the
environment variable is a number between
that we use to name/reference a DB.
👀 1
👍 1
If you want only one docker you could hardcode a list of targets (or use tags) and run tests just for those targets with concurrency set to 1.
Thank you! 🙏 Execution slot vars seem promising
with concurrency set to 1
How does one set concurrency to 1? I noticed there is a
option, but this seems to be related to pants invocations rather than test runs (and is the default behaviour).
But of course you are slowing down your builds quite a bit if you forgo concurrency, so if you can run N backing services and use the
mechanism to assign a unique one to each running test you'd get the best of both worlds!
Even if N is smaller than the number of cores (which is the default concurrency setting) but greater than 1 that's still a partial win!