Postgres container that will be run only once per test suite #5601
Answered
by
eddumelendez
Krzysztof-Lempicki
asked this question in
Q&A
|
Hi, In my project I am using SpringBoot and Spock. All my tests transactions are never committed. How to setup postgres container that will start before first test and |
Answered by
eddumelendez
Jul 18, 2022
Replies: 1 comment 1 reply
|
You can opt-in for container reuse feature.
@Shared
public GenericContainer container = new GenericContainer(SpockTestImages.HTTPD_IMAGE)
.withExposedPorts(80)
.withReuse(true)
You can create a BaseITSpecification which declares the container to be reused across your tests. Take into account that the container definition should be the same to be reused. |
1 reply
Answer selected by
Krzysztof-Lempicki
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can opt-in for container reuse feature.
withReuse(true)~/.testcontainers.propertiescontainer.start(). See docsYou can create a BaseITSpecification which declares the container to be reused across your tests. Take into account that the container definition should be the same to be reused.