Open rvem opened 5 months ago
I've looked at the code a bit more, and looks like the right way to solve the problem is to resolve this TODO
So the actual problem is that localhost
is resolved to [::1]
by head <$> getAddrInfo ...
, while the first entry in the container port binding is IPv4, thus an attempt to query [::1]
on IPv4 port fails.
Ideally, we'd need to resolve the docker host before figuring out the mapped port
Hmm, judging by testcontainers-go
and testcontainers-node
, this is somewhat known problem and their solution is to either not use IPv6 or specify IPv4 addresses in port bind explicitly
I stumbled upon https://github.com/moby/moby/issues/42442 which periodically breaks tests that are based on
testcontainers-hs
.One way to workaround this issue is to disable IPv6 altogether on the machine that runs tests, but IMO this doesn't sound like a nice solution since test suite results consistency will depend on local setup. Instead, it'd be better to run the
ryuk
container with--publish 127.0.0.1::8080
instead of--publish 8080
, however, this is not viable with the current interface provided bytestcontainers-hs
.What I propose to do is to add a version of
withContainers
function that will allow running theTestContainer
action either with customConfig
or with custom Reaper container.