You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My integration tests were working fine but I decided to switch the codebase to Kotlin and now I'm getting some PostgreSQL errors. When I run the tests for only one controller it works well but when I run mvn test I got the error.
Any idea? Below are the error and the AbstractIntegrationTest
Thanks.
Error
c.z.hikari.pool.PoolBase | HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection@6fe40fa8 (This connection has been closed.). Possibly consider using a shorter maxLifetime value.
.e.j.s.SqlExceptionHelper | SQL Error: 0, SQLState: 08001
.e.j.s.SqlExceptionHelper | HikariPool-1 - Connection is not available, request timed out after 30008ms.
.e.j.s.SqlExceptionHelper | Connection to localhost:49153 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 32.441 s <<< FAILURE! - in info.mtgmatches.adapter.web.MessageControllerTest
[ERROR] shouldSendMessage Time elapsed: 30.056 s <<< ERROR!
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
Caused by: org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30008ms.
Caused by: org.postgresql.util.PSQLException: Connection to localhost:49153 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Caused by: java.net.ConnectException: Connection refused
I haven't used Kotlin with Testcontainers for quite some time (I used it in the past and also wrote an article about it) but based on what I can see from your AbstractIntegrationTest is that you're mixing a controlled container lifecycle (using @Testcontainers) with a manual lifecycle (calling start/stop on your own).
If running one test works and running them all together fails with a Connection refuse, the issue must be in the lifecycle management of the container. Can you monitor your tests and especially docker ps to see how many PostgreSQL databases are started?
Hello!
My integration tests were working fine but I decided to switch the codebase to Kotlin and now I'm getting some PostgreSQL errors. When I run the tests for only one controller it works well but when I run
mvn test
I got the error.Any idea? Below are the error and the
AbstractIntegrationTest
Thanks.
Error
AbstractIntegrationTest
Controller
The text was updated successfully, but these errors were encountered: