Hi folks, I'm having a very strange issue with a t...
# help
c
Hi folks, I'm having a very strange issue with a test I am trying to write using wiremock. I have previously used wiremock successfully so I'm very confused at the issue I am having. When I run the test, I can see I run into the following error when it is trying to call out to the url which I have mocked. (information redacted):
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "<http://localhost:57360/><SOME_ID>/<url_slug>": Read timed out
The timestamp for that exception is about:
2024-06-03T14:12:35.41383+01:00
I can then see that WireMock then responds in a very short time after hitting this exception:
Copy code
2024-06-03 14:12:35.428 Request received:
127.0.0.1 - POST /<SOME_ID>/<url_slug>
Is this an issue anyone has experienced before? Thanks in advance!
b
Hi Catherine, which version of WireMock are you using? And do you remember which version you used before where it worked? Also, has something changed in the network setup, or in the request that is sent to WireMock?
Also, are you sure the Spring service that is calling the mock is properly spun up? It almost looks like something’s not entirely right on that side. Have you tried debugging the client code until just before the request to WireMock goes out?
c
The version I'm using is
org.wiremock:wiremock-standalone:3.3.1
which hasn't changed since February. I don't believe anything has changed in the network setup, I'm setting it up in a similar way to how I wrote these tests when I initially wrote them in wiremock. My current working theory is that the stub isn't quite properly attached in time for my request, the Spring Context I believe fully starts before running the tests, at which point I try and attach two stubs before making the request to the client. I've been trying to find ways to check these are in place before making the request but haven't found it so far
b
Yeah, that's the direction I was thinking in as well. Unfortunately it's impossible to debug / say something more useful about that without actually seeing what's happening from here. Good luck