Hello! I’ve started integrating wiremock-grpc. Que...
# wiremock-java
e
Hello! I’ve started integrating wiremock-grpc. Question - does it support adding delays to mock responses? I can’t seem to find that anywhere in the API…
o
@Tom ^
t
Yes, but at the moment you need to use the core WireMock DSL. We haven't added delays to the extension DSL yet.
e
Would that look something like this?
Copy code
this.wireMock.register(
      <http://WireMock.post|WireMock.post>(grpcUrlPath(LocationsGrpc.SERVICE_NAME, "GetRandomLocation"))
        .willReturn(
          message(DEFAULT_GRPC_LOCATION).build()
            .withFixedDelay(3_000)
        )
    );
if so, it doesn’t seem to work. It doesn’t respect the delay (it does serve the response immediately)
t
Yes, apologies - the gRPC extension has the effect of skipping the delay code so it needs to be factored out into a library class in WireMock core, then used in the extension.
👍 1