Allow container reuse opt-in via API
See original GitHub issueHello all,
I’ve enabled support for container reuse in Quarkus dev-services in Quarkus:
It’s working great, many thanks for the nice improvement; althought so far I’ve only enabled it for selected containers, specifically the ones running relational databases people use for testing.
I’m aware - and have documented - that people need to enable this opt-in by setting the relevant property in the .testcontainers.properties
configuration file.
This seems like a wise choice since the feature is currently experimental; yet people in our community have been asking to have this working by default on selected, cherry-picked containers, so it would be nice for us to have a way to opt-in for a particular container without people needing to edit the core configuration file.
I understand it’s possibly not a good time to do so, but eventually as the feature is considered more mature I’d love to see a way for the API to give a stronger hint to the Testcontainer core that a particular container really should be reused.
Proposal
One approach could be for the withReuse
method to accept a three-state enum rather than a boolean, like { OFF|ON|According_to_config }.
Additional consequences
The logic to stop containers in Quarkus also needs to know if the container is allowed to be reused. So I suspect some other methods will need to be adapted to support this as wel, such as isShouldBeReused
and possibly others.
Many thanks for the consideration! Reported on suggestion from cc/ @kiview at Devoxx 😃
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Fair enough, thanks for all explanations!
I’ll close this now, hopefully a better proposal will emerge in time 😃
Hey guys, If I understood correctly, this feature is not unstable already and can be marked as official behaviour.
So I’d remove unstable API in code and added extended javadoc for this, and a paragraph in the docs, that in this way we are trying to make the settings of the re-use of containers explicit to users from the outside.