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
Add possibility to skip container initialization without exception, when Docker not available #2833
Comments
Already implemented in #1530 @Testcontainers(disabledWithoutDocker = true) |
Hi @bsideup disabledWithoutDocker=true I still WANT TO RUN THE TEST, but skip the container intitialization. |
@skipidar I see now. I think this is a very unusual setup with many assumptions, and IMO it does not make sense to add it as a general purpose flag. To achieve what you want, you can create |
THnx @bsideup - have not understood your idea. but how would I use it? Where would I inject it into the testcontainers? |
Also doesnt the "disabledWithoutDocker" do two things now?
I think implicitely disabling the test - is not intuitive, I have not expected that. You also forgot about it I think :)
That would describe the behaviour in an explicit way and also solve my problem. |
@skipidar
The Testcontainers Jupiter extension works on Before: @Container
private GenericContainer<?> someContainer = ...; After: @Container
private Startable someContainerOrPredefinedValues = ...;
No, it does exactly one thing - skips the test completely if Docker is not found. It does not disable the containers initialization at all.
It is very explicit if you ask me. Line 64 in 0eb2dea
|
Thnx, this is how it looks like Startable
Usage
|
@skipidar glad to see that you got it solved. FTR I would advice against any use of fixed ports (spoiler - not even because of the ports!): |
I'm in a similar situation as @skipidar I've introduced testcontainers into our build obviously to have a 1:1 reproduceable build on CI and locally. But some people do not like the idea of docker magic happening in the background when they build locally. Is there a way to deactivate testcontainers via command-line similar to Alternatively, is @skipidar's solution from above also applicable when Docker Compose Module w/ Junit5 is used?
|
@bsideup We have the same issue when we want to use Testcontainers locally but during the CI/CD pipeline we want to use the service provided by the CI/CD platform. For example, we don't want to use Docker daemon within our CI pipeline due to security reasons and instead to use Adding The better way is to give the ability to switch from Testcontainers by adding a new annotation would set it to We would appreciate if such ability will be added and this issue will be opened again. |
@PavelZeger Hi, Pavel, i have the same issue now. Did you solve it, or you can't do it without new annotations from Testcontainers? |
Hello!
My setup
Problem statement
I am seeking for a possibility
During the development to disable testcontainers, but not the test, if docker is not available.
I would take care of providing the services, usually running in containers
Disabling the testcontainers should happen, depending on the settings in the environment, like ENV variable.
Because right now the only solution I dound is - to comment the @container statements, what gets checked in all the time.
Proposal of a solution
I suggest to introduce a flag at the
@org.testcontainers.junit.jupiter.TestContainers
annotation:skipContainersWithoutDocker=true
The text was updated successfully, but these errors were encountered: