Postgres container that will be run only once per test suite #5601
-
| 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 | 
Beta Was this translation helpful? Give feedback.
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. | 
Beta Was this translation helpful? Give feedback.
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.