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

Add Gripmock for grpc mocking #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

honourfish
Copy link
Contributor

No description provided.

gripmock/go.mod Outdated Show resolved Hide resolved
Copy link
Collaborator

@robinbryce robinbryce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a call maybe, but I think curling proto-include.tar.gz from a configured release is the best way to get the google & grpc headers now. Even in docker builds

&& rm -rf protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip

# Download common google api proto files.
ENV GOOGLE_COMMON_PROTOS_VERSION=1.50.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are present in the proto-include.tar.gz included on every release. the runes to install both the google headers and the grpc onese are just

rm -rf proto-include
curl -fsSOL https://github.com/datatrails/go-datatrails-common-api/releases/download/{{.DATATRAILS_COMMON_API_VERSION}}/proto-include.tar.gz
tar -zxf proto-include.tar.gz
rm proto-include.tar.gz

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The avid taskfiles/Taskfile_apis.yml bootstrap step is a good reference

Copy link
Collaborator

@robinbryce robinbryce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it. May want to huddle re use of proto-include.tar.gz

## Run gRPC mock server

```
docker run -p 4770:4770 -p 4771:4771 -v ~/workspace/go-datatrails-common-api:/protobuf -v ~/workspace/go-datatrails-common-api:/proto gripmock --imports=/protobuf,/usr/local/api-common-protos-master,/usr/local/include,/go/pkg/mod/github.com/envoyproxy/protoc-gen-validate@v1.0.2,/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@v2.18.0 /proto/datatrails-common-api/assets/v2/assets/service.proto
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use the proto-includes.tar these include paths get a lot simpler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants