hi folks, I ran into a small issue while using Ko...
# kotest
a
hi folks, I ran into a small issue while using Kotest and Testcontainers with the kotest-extensions-testcontainers today (details in đź§µ).
Following the documentation, I tried the following:
Copy code
val container = install(ContainerExtension(GenericContainer("mycontainer:latest"))) {
    withExposedPorts(8080)
}

...

container.getMappedPort(8080)
This code has two issues: • The GenericContainer API has changed, so this code doesn’t compile. To fix it, the image name must be parsed:
GenericContainer(DockerImageName.parse("mycontainer:latest"))
. Should the documentation be updated? • Calling
getMappedPort(8080)
fails with an exception. It seems the configuration block runs only after the container starts, so it has no effect. Calling
withExposedPorts
directly on GenericContainer solves the issue. Am I missing something?
Copy code
install(ContainerExtension(GenericContainer(DockerImageName.parse("mycontainer:latest")).withExposedPorts(8080)))