0

Here is part of my test:

@MicronautTest(startApplication = false)
@Testcontainers(disabledWithoutDocker = true)
class AggMapperIT : TestPropertyProvider {

    @Inject
    lateinit var aggMapper: AggMapper

    companion object {
        @Container
        @JvmStatic
        val postgres: PostgreSQLContainer<*> = PostgreSQLContainer(
            DockerImageName.parse("timescale/timescaledb:latest-pg14")
                .asCompatibleSubstituteFor("postgres")
        )
            .withDatabaseName("test")
            .withUsername("test")
            .withPassword("test")

    }

    override fun getProperties() = mutableMapOf(
        "datasources.default.url" to postgres.jdbcUrl,
        "datasources.default.username" to postgres.username,
        "datasources.default.password" to postgres.password,
    )


By some unknown reason I am getting connection refused as Failed to initialize pool: Connection to localhost:5432 refused.. I completely do not understand why no properties are overriden and container is ignored...

I have tried to fix using gemini,chat gpt,claude, called my friends, hamster and president of the US. Do not suggest tc based jdbc url as I need timescale db.

1
  • The only working solution now is to get rid of @MicronautTest annotation and init application context manually. But I am still interested in a solution using this annotation Commented Sep 9 at 9:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.