-
-
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
Expose OracleContainer image name property as public constant #1904
Conversation
Thanks @vpavic - I think this is pretty sensible. I just wonder if there's a more general solution that we could look at. #1345 will remove the image pull from the container constructor. This should make it safe to instantiate an We would then have freedom to add some methods to the container class itself - for example, You could then make your assumption be: WDYT? |
@rnorth Maybe I am missing something, but I thought this is not the point of @vpavic. I thought about a use case like: if (!TestcontainersConfiguration.getInstance().getProperties()
.containsKey(OracleContainer.IMAGE_NAME_PROPERTY)) {
TestcontainersConfiguration.getInstance()
.updateGlobalConfig(OracleContainer.IMAGE_NAME_PROPERTY, "myTestingImage");
} Not sure though? 😅 |
Thanks for the feedback @rnorth. Yes, @kiview is right - my idea was simply to support a safer way of verifying presence of The background is that in Spring Session we have an Oracle integration test that is conditional on presence of this property. This is needed due to lack of public Docker images for Oracle database so the test only runs when explicitly enabled. |
@kiview the code you linked should never be used, actually :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @rnorth that it would be better to not rely on internal details of the container (property) but on the behaviour, with maybe a helper method.
For now, one can attempt to instantiate a container and catch the exception
@bsideup Note that instantiating container is exactly what I prevent in this case, hence the use of this check in |
Any further feedback on this? To clarify a bit more, as can be seen from the example in the opening comment, I'm preventing the entire test class from being set up, and would like to do it in a less fragile way, referencing the constant (or possibly something else, but it has to be So any helper method would need to be |
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. |
This issue has been automatically closed due to inactivity. We apologise if this is still an active problem for you, and would ask you to re-open the issue if this is the case. |
Could this be reopened please? |
This makes it easier and safer for user code to refer to image name property. For example: