Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc extension is not working #116

Open
SButterfly opened this issue Oct 4, 2024 · 4 comments
Open

grpc extension is not working #116

SButterfly opened this issue Oct 4, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@SButterfly
Copy link

Proposal

I wanted to use wiremock grpc for my project, but it wasn't working.

proto contained of multiple files:
myservice.proto

syntax = "proto3";
package wallet.myservice;

import "wallet/errors.proto";

service MyService {
  rpc QueryEvents(QueryEventsRequest) returns (QueryEventsResponse) {}
}

message LogTruncated {}

message Error {
  oneof error {
    errors.OtherError other_error = 1;
    LogTruncated log_truncated = 2;
  }
}

message QueryEventsRequest {
  uint64 from = 1;
  uint64 to = 2;
}

message QueryEventsResponse {
  Error error = 1;

  uint64 from = 2;
  uint64 to = 3;

  repeated Event event = 4;
}
message Event {
  EventPayload payload = 2;
}

message EventPayload {
}

errors.proto

syntax = "proto3";
package wallet.errors;

message OtherError {
  string reason = 1;
}

mappings.json

{
    "request": {
        "method": "POST",
        "urlPath": "/wallet.myservice.MyService/QueryEvents"
    },

    "response": {
        "status": 200,
        "body": "{\"from\": 0, \"to\": 0}",
        "transformers": ["response-template"],
        "headers" : {
            "grpc-status-name" : "OK"
        }
    }
}

And run command

protoc \
  --descriptor_set_out wiremock-data/grpc/services.dsc \
  --proto_path proto_files \
  proto_files/wallet/myservice.proto

docker run -it --rm \
  -p 8080:8080 \
  --name wiremock \
  -v $PWD/wiremock-data:/home/wiremock \
  -v $PWD/extensions:/var/wiremock/extensions \
  wiremock/wiremock:3.9.1

Reproduction steps

I have created a sample project to reproduce the problem:
https://github.com/SButterfly/grpc-wiremock-bug

References

No response

@SButterfly SButterfly added the bug Something isn't working label Oct 4, 2024
@leeturner
Copy link
Collaborator

Are you still having this issue? Have you tried with the latest WireMock (3.10.0) and the latest gRPC extension ?

@SButterfly
Copy link
Author

@leeturner yes, the problem is the same.

@leeturner
Copy link
Collaborator

I have had a quick look at the demo project you posted. Thank you for that - it really helps.

I have just put a quick PR out to update a few things. Those changes get to a working base for me. There seemed to be some issues with the imported errors.proto so to keep things simple for now I removed the import and the associated referenced errors.OtherError.

Can you see if those changes work for you - https://github.com/SButterfly/grpc-wiremock-bug/pull/1/files

@leeturner
Copy link
Collaborator

Made a couple of tweaks to the repo to bring in the errors.proto and reference the errors.OtherError message

SButterfly/grpc-wiremock-bug@ec28537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants