At the root of all Testcontainers images we have GenericContainer, which has an instance field that always gets initialized:
public class GenericContainer /* ... */ {
protected DockerClient dockerClient = DockerClientFactory.instance().client();
}
The initialization of this field triggers an unavoidable need for a Docker environment to be available, and to ping the docker daemon which takes 3-4 seconds on my laptop. However, even though I am doing new GenericContainer() I don't call start() in some cases, but I still must pay the penalty for pining the Docker daemon.
Use case:
For local development I want to manually run a service and connect my test to that, but otherwise I want Testcontainers to spin up the containers (e.g. CI environment).
I know 3-4 seconds isn't a huge deal, but running my unit tests take <1 second locally, so it would be nice if we didn't have to pay the 3-4 second penalty for checking the docker env for situations where it wont' be used.
At the root of all Testcontainers images we have GenericContainer, which has an instance field that always gets initialized:
The initialization of this field triggers an unavoidable need for a Docker environment to be available, and to ping the docker daemon which takes 3-4 seconds on my laptop. However, even though I am doing
new GenericContainer()I don't callstart()in some cases, but I still must pay the penalty for pining the Docker daemon.Use case:
For local development I want to manually run a service and connect my test to that, but otherwise I want Testcontainers to spin up the containers (e.g. CI environment).
I know 3-4 seconds isn't a huge deal, but running my unit tests take <1 second locally, so it would be nice if we didn't have to pay the 3-4 second penalty for checking the docker env for situations where it wont' be used.