https://linen.dev logo
#help
Title
# help
f

Federico Silveri

03/05/2024, 12:11 PM
Hi, I need help fixing an integration tests written in
Java
that stopped working after upgrading the version from
3.0.4
to
3.4.2
issue:
My test is failing because I have a timeout set to 3" and my API are not receiving any response from WireMock within that timeframe. This is how I configured the WireMockServer instance:
Copy code
final WireMockConfiguration options = new WireMockConfiguration().dynamicPort();
this.wireMockServer = new WireMockServer(options);
this.wireMockServer.start();
And here is my stub:
Copy code
this.wireMockServer.stubFor(get(new UrlPathPattern(containing(**URL**), true))
        .inScenario("test scenario")
        .whenScenarioStateIs(STARTED)
        .willSetStateTo("test scenario 1")
        .withHeader(AUTHORIZATION, equalTo("Bearer " + token))
        .willReturn(aResponse()
                .withBody(mapper.serialize(response).orElseThrow())
                .withHeader(CONTENT_TYPE, APPLICATION_JSON)));
I tried to progressively upgrade the version from
3.0.4
and I'm starting to see the issue from
3.3.1
(same issue with
3.3.0
but I'm not using it since it's been marked as discarded). I tried to look at the release note but I couldn't find anything to the issue I'm having. I would really appreciate anyones help 🙏 🙂
t

Tom

03/05/2024, 3:18 PM
Does the test pass if you raise the timeout, or is the response not arriving at all?
f

Federico Silveri

03/05/2024, 3:27 PM
The response is not arriving at all
t

Tom

03/05/2024, 3:29 PM
I can’t see any obvious reason from the code you’ve shared. Does anything useful get logged if you enable verbose mode?
f

Federico Silveri

03/05/2024, 3:57 PM
Nope ☹️
It's only logging
Verbose logging enabled
Nothing else, like it never receive the request
t

Tom

03/05/2024, 4:01 PM
Can you create a minimal reproducer project?
f

Federico Silveri

03/05/2024, 4:03 PM
I've also tried to hit the
__admin/mappings
endpoint via Postman, but I get
Error: socket hang up
in return.
t

Tom

03/05/2024, 4:04 PM
That suggests either it’s not starting at all or something in your surrounding infra has changed
Are you using http or https?
f

Federico Silveri

03/05/2024, 4:04 PM
Is there a way to check if the WireMockServer is actually up and running?
t

Tom

03/05/2024, 4:04 PM
The way you’ve just tried is as good as any
f

Federico Silveri

03/05/2024, 4:04 PM
Are you using http or https?
http
t

Tom

03/05/2024, 4:05 PM
Are you running it from within Java or standalone?
f

Federico Silveri

03/05/2024, 4:05 PM
within Java
t

Tom

03/05/2024, 4:05 PM
🤔
Wondering whether there’s been a transitive dependency change somewhere that’s broken it i.e. something in your project is supplying a different version to the one WireMock expects and is breaking it
Might be worth temporarily switching to the standalone artifact in your build and seeing if that makes any difference
f

Federico Silveri

03/05/2024, 4:41 PM
Wondering whether there’s been a transitive dependency
That was the issue, the
http2-server
version was set to a previous (11.0.16) one that perhaps was preventing the wiremock server to startup properly.
Thank you so much for your help 🙏 🙌
👍 1
16 Views