testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

[Enhancement]: Add ability to specify dockerProvider for NewDockerComposeWith to be able to disable reaper

Open quolpr opened this issue 1 year ago • 15 comments

Proposal

The problem: on dev machine I want to have tests to run fast. We are using docker compose way to prepare test env, and after test run all containers are deleting. I actually want to keep them running, and to achieve this I need to specify env variables to disabled reaper. It's actually not comfortable way, and I want to be able to specify ryuk config manually.

What I suggest is to add to composeStackOptions new field dockerProvider *testcontainers.DockerProvider + new opt WithDockerProvider(provider *testcontainers.DockerProvider). So then I can call it with:

pr, err := testcontainers.NewDockerProvider()
if err != nil {
  return err
}
c := pr.Config().Config
c.RyukDisabled = true

tc.NewDockerComposeWith(tc.WithDockerProvider(pr))

quolpr avatar Jul 24 '24 08:07 quolpr