-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
GenericContainer tries to talk to remote registry too soon (during instance initialization) #302
Comments
@ldcasillas-progreso this is something I want to change as well, yes :) You just hit the leftover from a change to allow Dockerfiles. As a workaround, you can use new GenericContainer(CompletableFuture.completed("vault:1.2.3")) testcontainers-java/core/src/main/java/org/testcontainers/containers/GenericContainer.java Lines 153 to 155 in 935a2db
|
@bsideup Thanks for the workaround! It definitely helped in our narrow case, but I would observe that I still see TestContainers (now upgraded to 1.1.9) doing some stuff:
I haven't tried running in a system without Docker, so I didn't establish whether this would cause a failure in that case. |
Relates to #343 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this. |
I'm running tests on a machine that doesn't currently have connectivity to the Docker Hub. Certainly, I expect TestContainer-based cases to fail in that case. So I have written a JUnit rule to conditionally disable these test cases when a certain configuration setting has been made, and write something like this in my test case:
The problem I'm seeing is, however, that this requires instantiating the
VaultContainer
class, which will call theGenericContainer
constructors, and those constructors will actually try to talk to the Docker Hub:The problem is here (line numbers don't match up because the stack trace is from 1.1.6):
There's a very interesting comment there ("Mimic old behavior where we resolve image once it's set") that tells us that this behavior is intentional. What I would suggest is that the behavior is at odds with the sort of uses that JUnit rules are meant to support; the test rule should arguably take no "risky" actions at all unless the
Statement
is actually invoked, i.e. in theGenericContainer.start()
method, which already does call thegetDockerImageName()
method anyway. (And is it just me, or is it also weird that aString
getter likegetDockerImageName()
would talk to the network?)The text was updated successfully, but these errors were encountered: