Closed jeacott1 closed 6 years ago
@jeacott1 are you using JDBC-based support? If so, just remove PostgreSQLContainer
from your code.
aah, right, I missed that the 2 methods are independent.
thats a shame as without the rule wouldnt I lose test lifecycle support?, but modifying the jdbc url makes testing with testcontainers as easy as with h2.
I had thought the custom driver was doing the dynamic discovery of a container launched via the rule,
and perhaps thats an option that could be considered?
regardless its now clear why I see 2 instances launched.
thanks.
@jeacott Testcontainers will automatically stop the container when you close your JDBC driver connection (i.e. when Spring app stops), so you're not loosing the lifecycle support actually :)
I have a spring boot application and a junit 4 test marked with:
but I'm noticing that docker is actually running 2 instances of postgres:
it all eventually gets cleaned up, but this looks wrong.
I never get 2 instances of Elasticsearch, and everything else seems fine.
if I configure a regular spring test and don't point the config at the main springBoot Application class, but just regular @Configuration annotated classes, then I get just a single instance of the postgres docker, but that obviously isn't useful for integration tests.