Skip to content

Centralize Postgres container initialization utilities#1633

Open
jgaleotti wants to merge 6 commits into
masterfrom
fix_postgres_container_flakiness
Open

Centralize Postgres container initialization utilities#1633
jgaleotti wants to merge 6 commits into
masterfrom
fix_postgres_container_flakiness

Conversation

@jgaleotti

Copy link
Copy Markdown
Collaborator

Fixes bug causing "FATAL: the database system is starting up" error during container setup.

…ize Postgres container initialization and JDBC URL retrieval using `PostgresContainerUtils`.
@jgaleotti jgaleotti requested a review from arcuri82 July 7, 2026 22:13
@@ -0,0 +1,48 @@
package com.foo.spring.rest.postgres

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@jgaleotti jgaleotti requested a review from arcuri82 July 9, 2026 14:06
Comment thread client-java/postgres-test-utils/pom.xml Outdated
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>provided</scope>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why provided?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants