Issue
I have a stub that I can see under /__admin/ but when making any sort of rest calls nothing registers in either __admin/requests or __admin/requests/unmatched which I feel is strange. Is Wiremock failing to intercept the request?
Simplified code:
class MyTestClass {
@Test
void testStuff(){
WireMock.configureFor("localhost", 9050); // Running in docker with custom port
WireMock.reset();
stubFor(
get("/getStuff?include-archived=yes")
.withPort(<myServicePort>)
.willReturn(
aResponse()
.withHeader("Content-Type", "application/json")
.withStatus(200)
)
);
}
}
Error:
Error has been observed at the following site(s): *__checkpoint ⇢ Request to GET http://localhost:<myServicePort>/getStuff?include-archived=yes [DefaultWebClient]
...
[org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] : Resolved [org.springframework.web.reactive.function.client.WebClientRequestException: Connection refused: no further information: localhost/127.0.0.1:<myServicePort>; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:<myServicePort>]
Solution
Finally found the issue, the port that I was trying to intercept wasn't open in the container thus why I got no entries in either __admin/requests or __admin/requests/unmatched
Answered By - David S
Answer Checked By - Robin (JavaFixing Admin)