Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Use existing container (if it already exists) even if it was not created by TestContainers #1206

Open
InspiringCode opened this issue Jul 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@InspiringCode
Copy link

Problem

I have a container with a SQL Server that is quite resource hungry. I want to share the same docker container for my tests and for local development (F5). For local development I intent to use docker compose to start up the container. Using WithReuse doesn't work in this case, even if I manually add a reuse-id to my compose.yaml, because TestContainers always checks if a container with the reuse hash exists. In my case it tries to create a new container which results in a 409 Conflict being returned by docker.

Solution

Ideally I would be able to point to my compose.yaml file and TestContainers would just run docker compose up and wait for the container to be up and running.

But since this feature request is not really making progress, I am wondering if there is any way to achieve a similar result? Would it make sense to add an option to ignore the reuse hash?

Benefit

I some cases one really wants to share an environment between local dev and unit tests. This feature would enable this scenario.

Alternatives

One would theoretically reference the TestContainers assembly also in the production ASP.NET Core application (maybe with a "Is Debug Build" condition) and also call the ContainerBuilder there. But I am really not sure if this is a good idea?

Would you like to help contributing this enhancement?

No

@InspiringCode InspiringCode added the enhancement New feature or request label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant