5.0.2 is out with a bunch of fixes <https://kotest...
# kotest
s
5.0.2 is out with a bunch of fixes https://kotest.io/docs/changelog.html
πŸŽ‰ 6
K 1
t
I just merged a dependency update to 5.0.1 5 minutes ago 😞
s
ha sorry
Now you get to make another commit!
πŸ˜‰ 1
b
Are the new MPP engine setup docs available already?
s
No need to do that still, help is always welcomed.
b
I would if I wouldn't need the docs myself to understand the changes :D
s
hah
definitely by the end of the weekend, I have time on sunday if not before
b
Can you make a release-like announcement on #kotest once they're out so I could stop bugging you with the same questions?
s
yep
b
Much appreciated!
s
reminders set
p
still having my testcontainers startup issue with 5.0.2 😒
s
yeah I'm publishing 1.1.0 which will work with 5.0.2
🀞 1
πŸ™ 1
1.1.0 is out if you want to try it
p
ok cool πŸ‘€
still the same problem unfortunately 😞
s
can you recap your issue
p
yep, working on a minimal case, brb
Copy code
class UserSpec: WordSpec() {
    private val network = Network.newNetwork()

    private val postgresContainer = PostgreSQLContainer(DockerImageName.parse("postgres:13"))
        .withDatabaseName(config.databaseConfig.databaseName)
        .withUsername(config.databaseConfig.username)
        .withPassword(config.databaseConfig.password.value)
        .withExposedPorts(5432)
        .withNetwork(network)

    init {
        listener(postgresContainer.perSpec())

        "Users Route" should {
            "" {
                
            }

        }
    }

    override fun beforeSpec(spec: Spec) {
        println(" ${postgresContainer.firstMappedPort}")
    }
}
the
postgresContainer.firstMappedPort
fails with
Copy code
Caused by: java.lang.IllegalStateException: Mapped port can only be obtained after the container is started
      at org.testcontainers.shaded.com.google.common.base.Preconditions.checkState(Preconditions.java:174)
      at org.testcontainers.containers.ContainerState.getMappedPort(ContainerState.java:142)
      at java.base/java.util.Optional.map(Optional.java:265)
s
the perSpec listener is probably firing after your before spec
p
100% worked in 4.6.3, 100% failure in 5.x
s
the order is not guaranteed and probably changed between releases
p
😒
s
we can fix that by moving to a test case extension
p
i use the
beforeSpec
to setup the connection pool & do flyway etc
s
Yeah that's fine, you just need the container to be guaranteed to fire first, I'll fix it, might take 30 mins
p
thank you!
s
If you use the new jdbc container stuff, then you should be good
Copy code
class UserSpec: WordSpec() {
    private val network = Network.newNetwork()

    private val postgresContainer = PostgreSQLContainer(DockerImageName.parse("postgres:13"))
        .withDatabaseName(config.databaseConfig.databaseName)
        .withUsername(config.databaseConfig.username)
        .withPassword(config.databaseConfig.password.value)
        .withExposedPorts(5432)
        .withNetwork(network)

    val ds = install(JdbcTestContainerExtension(postgresContainer)) {
       maximumPoolSize = 8
       minimumIdle = 4
    }

    init {

        "Users Route" should {
            "" {
                
            }

        }
    }

    override fun beforeSpec(spec: Spec) {
        println(" ${postgresContainer.firstMappedPort}")
    }
}
βœ… 1
πŸ‘€ 1