Skip to content

Commit 799ea7a

Browse files
committed
feat: add comment about PostgresIntegrationTest
1 parent 142ad63 commit 799ea7a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/test/java/com/itasocialacademy/oitassist/PostgresIntegrationTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
import org.testcontainers.containers.PostgreSQLContainer;
88
import org.testcontainers.utility.DockerImageName;
99

10+
/**
11+
* Deliberately does NOT use {@code @Testcontainers}/{@code @Container}: those
12+
* tie the container's stop() to the JUnit lifecycle of whichever test class
13+
* triggers it first, which kills the container for every other IT class sharing
14+
* this singleton across the same JVM (see: Testcontainers "Singleton
15+
* Containers" pattern). The container is started once in this static
16+
* initializer and lives for the JVM's lifetime; cleanup is handled by the Ryuk
17+
* reaper container at JVM exit, not by JUnit.
18+
*/
1019
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
1120
@ActiveProfiles("test")
1221
@Tag("integration")

0 commit comments

Comments
 (0)