lundi 23 décembre 2019

Wiremock failing with VerficationException even though there is no verification assertion

I'm using standalone wiremock and my application is written in scala. When I try to insert the stubs into the Wiremock server, I get the following error:

[error] java.lang.IllegalStateException: com.github.tomakehurst.wiremock.client.VerificationException: Expected status 2xx for https://****-my-wiremock-server.com:443/__admin/mappings but was 502

The issue doesn't pop up immediately, it actually does insert stubs for much of the time. It just reaches this point where it fails.

The code where it throws the error looks something like this:

private def setupWiremockIdServiceUser(uri: URL, someValue: String, maskedId: String, latency: Int = 0): Unit = {
    configureWireMock(uri)

    WireMock.stubFor(
      get(urlEqualTo(s"/some/path"))
        .withHeader("Header1", new AnythingPattern())
        .withHeader("Header2", new AnythingPattern())
        .withHeader("Header3", new AnythingPattern())
        .willReturn(okJson(
          s"""
             |{
             |  "returnValue": = s"$someValue"
             |}
           """.stripMargin
        ).withFixedDelay(latency))
    )
  }

It complains specifically about the line .withFixedDelay(latency). This could just be because it is the final line but this error also started happening after I added this in.

Aucun commentaire:

Enregistrer un commentaire