Centralize Postgres container initialization utilities#1633
Conversation
…ize Postgres container initialization and JDBC URL retrieval using `PostgresContainerUtils`.
| @@ -0,0 +1,48 @@ | |||
| package com.foo.spring.rest.postgres | |||
There was a problem hiding this comment.
we should really avoid code-duplication.
here, the same class is repeated 3 times.
better to put it in its own module (client-java/postgres-test-utils), and import it where needed
…s-test-utils` module to eliminate duplication across projects.
| <dependency> | ||
| <groupId>org.testcontainers</groupId> | ||
| <artifactId>testcontainers</artifactId> | ||
| <scope>provided</scope> |
There was a problem hiding this comment.
I followed the same solution that in client-java/test-utils-java/pom.xml for resolving testcontainers. I cannot use the test in this case because class PostgresContainerUtils is located within src/main/java. Should I do something different in this scenario?
There was a problem hiding this comment.
@jgaleotti remove the provided. the default compile is fine in this case, as it is a test utility module. client-java/test-utils-java/pom.xml is very special, and provided there has its reason... which i guess i should write down in a comment there :)
… in postgres-test-utils.
Fixes bug causing "FATAL: the database system is starting up" error during container setup.