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 · 0 comments
Open

grpc extension is not working #116

SButterfly opened this issue Oct 4, 2024 · 0 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
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

1 participant