-
-
Notifications
You must be signed in to change notification settings - Fork 252
Description
Not sure if this is the right platform to ask, please direct me to any other platform if not.
I am utilizing testcontainers to test a large project. I specifically use the compose module to bring the environment up and run a good number of test cases. I would like to create an fresh environment each time, but the time cost of bring the environment up is too high.
Is there anyway to bring up the environment once and reuse it across the different tests?
I tried to use the .withNoRecreate() option (From #288). But it seems to be not having any effects (It might be that I am using it wrongly or I am downing the env?).
I just wanted to know if there are any best practices to create such a singleton environment, or has anyone already implemented anything similar to this. I have attached code blocks of how I create and stop the env.
// before hook to start env
environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
.withWaitStrategy("service-one", Wait.forHealthCheck())
.withWaitStrategy("service-two", Wait.forLogMessage(/Server started/))
.withNoRecreate()
.up();
// Run Tests
// After hook to bring down the env
await environment.down();
Thanks for maintaining such a valuable project!