testcontainers / testcontainers-hs

Docker containers for your integration tests! http://hackage.haskell.org/package/testcontainers
MIT License
56 stars 12 forks source link

Add waitForHttp #24

Closed michivi closed 1 year ago

michivi commented 1 year ago

This PR adds the waitForHttp which waits until the given container port returns one of the acceptable status codes.

This is required as in some cases, waitUntilMappedPortReachable is not enough: the containerized Web container is listening to requests but is actually still not ready to take them.

Some notes regarding this implementation:

michivi commented 1 year ago

Sorry, the code was only working if the test program is not in a container. Let me just fix this so it works both in a container, and on the host.

michivi commented 1 year ago

Ok, the waitForHttp function now works within and outside of a Docker network: