Open szokebarnabas opened 2 years ago
Hi @szokebarnabas,
It's should be possible to define request matchers and return responses accordingly.
Could you please elaborate with an example, what kind of request matchers are you referring to?
I'm unsure if this is a bug or if this isn't documented or supported.
Take HTTP: Camouflage mocks HTTP by having you provide the entire HTTP response in your *.mock
file, including status code headers, etc. This would allow me to test scenarios like when the server responds with a HTTP 400, then I can verify my app behaves accordingly.
Similarly in gRPC we have status codes and I may want to do the same thing where I configure camouflage to return GRPC 16 "Unauthorized" so that I can verify my app behaves accordingly when such a thing happens. I don't see it documented.
Since I'm proxying with envoy to camouflage, I also would like to set headers but I know I may be asking for too much there.
Describe the bug Hi, apologies in advance if the answer to my question is trivial but I don't have any experience with gRpc and protobufs.
What I would like to achieve is:
To Reproduce Steps to reproduce the behavior:
mocks:
protos:
volumes: prometheus_data: {} grafana_data: {} camouflage_data: {}
services: camouflage_ui: image: shubhendumadhukar/camouflage-filemanager:latest container_name: camouflage_ui_2 volumes:
"3001:3001" labels: org.label-schema.group: "camouflage"
camouflage: image: shubhendumadhukar/camouflage:latest container_name: camouflage_2 volumes:
{ "warnings": [ "hello" ], "schema_change": { "change_type": "CREATED" }, "result_set": { "columns": [ { "name": "my column", "type": { "basic": "ASCII" } } ], "rows": [ { "values": [ { "string": "hello world" } ] } ] } }
grpcurl -v -d '{"queries":[{"cql":"UPDATE bookmarking.bookmarks USING TTL :ttl AND TIMESTAMP :timestamp SET streamPosition = :streamposition, created = :created WHERE pvid = :pvid AND providerterritory = :providerterritory AND provider = :provider AND householdId = :householdid AND timeBucket = :timebucket and personaId = :personaid;"}]}' -proto query.proto -proto stargate.proto -plaintext localhost:4312 stargate.Stargate/ExecuteBatch
Resolved method descriptor: // Executes a batch of CQL queries. rpc ExecuteBatch ( .stargate.Batch ) returns ( .stargate.Response );
Request metadata to send: (empty)
Response headers received: content-type: application/grpc+proto date: Fri, 02 Sep 2022 07:38:52 GMT grpc-accept-encoding: identity,deflate,gzip
Response contents: { "warnings": [ "hello" ], "schemaChange": { "changeType": "DROPPED" } }
Response trailers received: (empty) Sent 1 request and received 1 response