Problem
I am using a message broker container with reuse.
I am using other transient containers that need to be able to reach the host.
I am requesting TestContainers expose the ports after creating the reuse container, but before the transient containers. When ran in isolation this works well.
I am using TestContainers to run multiple integration tests at the same time, sharing the reuse container between multiple tests.
The issue I am facing is the second test runs, attempts to start the reuse container (which is already running, and was started before the PortForwardingContainer), but the builder now has ExtraHosts configured because the PortForwardingContainer is now running. Thus the hash calculation is different and the reuse container is now a clash.
This is because the default implementation of container builder init is to apply the port forwarding if the (static) PortForwardingContainer is running.
Solution
Provide the ability for a container builder to clear the ExtraHosts
OR expose WithPortForwarding such that a container builder can 'opt in' to using the PortForwardingContainer
Benefit
Container reuse would cooperate with transient containers that require port forwarding
Alternatives
N/A
Would you like to help contributing this enhancement?
Yes
Problem
I am using a message broker container with reuse.
I am using other transient containers that need to be able to reach the host.
I am requesting TestContainers expose the ports after creating the reuse container, but before the transient containers. When ran in isolation this works well.
I am using TestContainers to run multiple integration tests at the same time, sharing the reuse container between multiple tests.
The issue I am facing is the second test runs, attempts to start the reuse container (which is already running, and was started before the PortForwardingContainer), but the builder now has ExtraHosts configured because the PortForwardingContainer is now running. Thus the hash calculation is different and the reuse container is now a clash.
This is because the default implementation of container builder init is to apply the port forwarding if the (static) PortForwardingContainer is running.
Solution
Provide the ability for a container builder to clear the ExtraHosts
OR expose WithPortForwarding such that a container builder can 'opt in' to using the PortForwardingContainer
Benefit
Container reuse would cooperate with transient containers that require port forwarding
Alternatives
N/A
Would you like to help contributing this enhancement?
Yes