Replace portBindings.add with standard way of exposing ports
How to expose ports: https://www.testcontainers.org/features/networking/#exposing-container-ports-to-the-host
Where to fix: https://github.com/allegro/envoy-control/blob/b74ba3c64f1ea30dd531f8bb98086e7f4b4f6e1d/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/config/consul/ConsulContainer.kt#L30
I'd like to take this one
I've assigned you. Have fun :)
Unfortunately container.getMappedPort() works only after starting containers. Test classes logic relies on fetching the port number before starting container, so in my opinion current implementation is justified.
I think @slonka had in mind using .withExposedPorts(8080, 8081) instead of portBindings.add("$externalPort:$internalPort")