Skip to content

grpc extension is not working #116

Open
@SButterfly

Description

@SButterfly

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions