-
Notifications
You must be signed in to change notification settings - Fork 126
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
Could val container
by lazy by default?
#81
Comments
It could be Also, in the near future, we will release a new API in which you will not have the issue you described. |
Yes obviously We also could argue that the container shouldn't be re-created every time the method is called? (hence really being a lazy val and not def) <= not sure about this. |
It will not break user code — you can override |
Thanks, I forgot about that. Thanks for your explanations! |
Got a few minutes to file a PR. |
Hello, and thanks for your great work! Using it on a daily basis, works like a charm.
Here's the (mini) problem I ran into.
I have a set of standard
test
that are run through thetest
(and thusbuild
task) => they're pure unit tests or PBT, they don't need testcontainers (the faster they run the faster the feedback-loop...)I have a set of
integrationTest
using testcontainers-scala. They're quite heavy-on-ressources (docker-compose, etc.). They're simply here to assert that "in a real environment, things should work". They're run through a dedicated task, not every build.I chose to use an annotation for these integration test classes so that I can exclude them through ScalaTest
tags
(I'm using scalatest-gradle-plugin). But even when excluded, they're still instanciated, and thusval container = /* ... */
is still executed (checking Docker version etc.).This is not a real problem for me, since everywhere
test
are run, there's a docker daemon, but it could be problematic if not.The very simple fix for me was to declare:
This seems to work perfectly fine and achieve what I need it to achieve.
I was just wondering if other people ran into this issue? And if yes, could it be "lazy" by default?
wdyt?
The text was updated successfully, but these errors were encountered: