Hello, Can somebody help with grpc mocking? I a...
# help
а
Hello, Can somebody help with grpc mocking? I am using wiremock-jetty12 and wiremock-grpc-extension. (latest versions). I am trying to mock my grpc server and test my client, but I receive strange errors. Logs from wiremock console notifier
Copy code
127.0.0.1 - POST /com.example.MyService/GetStatus

content-type: [application/grpc]
te: [trailers]
user-agent: [grpc-java-netty/1.65.0]
grpc-accept-encoding: [gzip]

123


Matched response definition:
{
  "status" : 200,
  "body" : "{\n  \"id\": \"123\"\n}",
  "headers" : {
    "grpc-status-name" : "OK"
  }
}

Response:
HTTP/2.0 200
grpc-status-name: [OK]
Matched-Stub-Id: [657ca985-dc4e-4da5-8c6b-07de073d8b8d]
And this is the error log from my application code (grpc-java)
Copy code
io.grpc.StatusRuntimeException: UNKNOWN: HTTP status code 200
invalid content-type: null
headers: Metadata(:status=200,grpc-status-name=OK,matched-stub-id=657ca985-dc4e-4da5-8c6b-07de073d8b8d)
DATA-----------------------------
{
  "id": "123"
}
DATA-----------------------------

	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268) ~[grpc-stub-1.65.0.jar:1.65.0]
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249) ~[grpc-stub-1.65.0.jar:1.65.0]
It is really strange. The
:status
should have been set to 0 I guess
l
I can’t tell if this is related to your issue based off of the error you posted but I don’t think the grpc extension currently supports the use of jetty 12. Is there any way you can use jetty 11 ?
а
Well, I moved to jetty12, because I stuck to another issue, trying to use the pure wiremock dependency
Copy code
Caused by: com.github.tomakehurst.wiremock.common.FatalStartupException: Jetty 11 is not present and no suitable HttpServerFactory extension was found
l
Ah, I see. I think you might be out of luck with the combination of versions until we release a version of the grpc extension that supports jetty 12. As you can see here, we are specifically creating a Jetty11HttpServer
а
I was able to make it work, switching both wiremock and grpc extension to the standalone dependency. Thank you Lee, for the guidance
l
Awesome news
256 Views