My application has a test that makes a call to my API and, inside that logic, it makes another call to another endpoint.
In order to execute it, I exec into the docker container and run the tests using PHPUnit, which creates a web server on localhost:8880.
The test is something like this: It makes a POST call to localhost:8880/a/b and inside there, it will make a call to localhost:8880/x. This is where the problem resides, since this second call will be pending forever (or until it times out).
Needless to say, this logic works fine when I execute the endpoint outside the test environment or without using Docker, I only encounter this issue when running the tests inside a docker container.
I’ve tried changing that second call from localhost to 127.0.0.1:8880/x, but that still didn’t seem to work.
Any ideas on what the problem is and how can it be fixed?