This repository can be used to build a docker image that leverages
grpc-mock (https://github.com/YoshiyukiKato/grpc-mock) to provide
a mock GRPC server that can be utilized for testing.
To utilize this image protobuf file(s) must be supplied as well as
a node.js file to create the server. There is an example in the
example directory.
To run the example you can use the following docker command:
docker run -tid \
--name mock --rm -p 50051:50051 \
-v $(pwd)/example:/proto \
ciena/grpc-mock /proto/mock.js
The utility grpcurl can be used to test the mock server using the
following command:
grpcurl -proto $(pwd)/example/greeter.proto \
-plaintext \
-d '{"message": "Hello"}' \
localhost:50051 greeter.Greeter/Hello
In the example directory there is input samples for the streaming requests to use these files
you can issue commands similar to the following (substituting the appropriate input file and
method name):
cat example/chat-1.json | grpcurl -proto $(pwd)/example/greeter.proto \
-plaintext -d @ localhost:50051 greeter.Greeter/Chat
To enable debugging information when running the mock server the following environment variables can be set when starting the mock server container:
GRPC_VERBOSITY=DEBUG
GRPC_TRACE=all
Content type
Image
Digest
Size
49.9 MB
Last updated
over 7 years ago
docker pull ciena/grpc-mock