When I am trying to run tests in a VM in gitlab, I get the following error only on the first test. All other tests pass without any problem. I do not have this issue when I run the tests locally on my local host.
[info] java.sql.SQLTransientConnectionException: db - Connection is not available, request timed out after 1000ms.
[info] at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:548)
[info] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:186)
[info] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145)
[info] at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:83)
[info] at slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:18)
[info] at slick.jdbc.JdbcBackend$BaseSession.<init>(JdbcBackend.scala:439)
[info] at slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:47)
[info] at slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:38)
[info] at slick.basic.BasicBackend$DatabaseDef.acquireSession(BasicBackend.scala:218)
[info] at slick.basic.BasicBackend$DatabaseDef.acquireSession$(BasicBackend.scala:217)
It seemed to me to be a connection problem: play/slick/hikari does not have enough time to connect to the database and then, timeout. Therefore, I tried to change the configuration with the following parameters:
play.db.prototype.hikaricp.hikaricp = 60 seconds
play.db.prototype.hikaricp.initializationFailTimeout = 60 seconds
However, I still have the same issues. Rarely, the tests pass (with or without the configuration change). Any idea about how to troubleshoot further and/or what to investigate or change?
Note: I am on Play 2.6.20
Note2: for testing, I am using gitlab and pull the image openjdk:11