-
Notifications
You must be signed in to change notification settings - Fork 8
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
consumer-go test: connection reset while testing in docker environment #28
Comments
TY for providing a Dockerfile Just tried running the plugin directly in the container which fails
{
"pluginInterfaceVersion": 1,
"name": "protobuf",
"version": "0.3.2",
"executableType": "exec",
"minimumRequiredVersion": null,
"entryPoint": "pact-protobuf-plugin",
"entryPoints": {},
"dependencies": null,
"pluginConfig": {
"downloadUrl": "https://github.com/protocolbuffers/protobuf/releases/download",
"protocVersion": "3.19.1",
"hostToBindTo": "127.0.0.1"
}
}
Error: Failed to bind to host '[::1]'
Caused by:
Address not available (os error 99) I tweaked it slightly to lock the platform FROM --platform=linux/amd64 golang:1.20-bullseye
ARG PACT_GO_VERSION=v2.0.0-beta.18
ARG PACT_PLUGIN_CLI_VERSION=v0.0.0
ARG PACT_PLUGIN_PROTOBUF_VERSION=v-0.3.2
ARG BUF_VERSION=v1.21.0
# Install deps
RUN apt clean && apt update
RUN apt install -y git-core gcc wget protobuf-compiler golang-goprotobuf-dev
# Install pact-go
RUN go install github.com/pact-foundation/pact-go/v2@${PACT_GO_VERSION}
RUN pact-go install
# Install buf
RUN go install github.com/bufbuild/buf/cmd/buf@${BUF_VERSION}
# Install pact-plugin-cli + protobuf plugin
RUN wget https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-${PACT_PLUGIN_CLI_VERSION}/pact-plugin-cli-linux-x86_64.gz
RUN gunzip pact-plugin-cli-linux-x86_64.gz
RUN mv pact-plugin-cli-linux-x86_64 /usr/local/bin/pact-plugin-cli && chmod +x /usr/local/bin/pact-plugin-cli
RUN pact-plugin-cli -y install https://github.com/pactflow/pact-protobuf-plugin/releases/tag/${PACT_PLUGIN_PROTOBUF_VERSION}
ENTRYPOINT [ "/bin/bash" ] |
Hmm It isn't picking up the root@5f781238efcb:/go# $HOME/.pact/plugins/protobuf-0.3.2/pact-protobuf-plugin --help
Pact plugin for Protobufs and gRPC
Usage: pact-protobuf-plugin [OPTIONS]
Options:
--help Print help and exit
-v, --version Print version information and exit
-t, --timeout <timeout> Timeout in seconds to use for inactivity to shutdown the plugin process. Default is 600 seconds (10 minutes)
-h, --host <host> Host to bind to. Defaults to [::1], which is the IP6 loopback address
root@5f781238efcb:/go# $HOME/.pact/plugins/protobuf-0.3.2/pact-protobuf-plugin -h 127.0.0.1
{"port":35353, "serverKey":"6112dec6-9220-4e35-9d04-8e477b9cef61"} |
hmm, so it works if you pass it the args directly
run with
Now I am sure
|
So when we start the mock server here (via the plugin) pact-protobuf-plugin/src/server.rs Lines 604 to 606 in 40c4ea3
we take the plugin_config and pass it to create a new gRPC server but when we start it, we pass the
|
Just a note, the plugin executable assumes it's current working directory is set to the plugin directory, so running the following works:
|
This is not only affecting docker environments, looks like our example CI build is failing in the same way.
|
Hmm, it works for me upgrading Pact-Go to the latest: Then:
|
Hey guys Thanks for looking into the problem. Upgrading to beta.21 also fixed the problem in my case. It might be good to update the documented examples to the latest version too. Anyways I guess we can close this issue. |
Thanks for letting us know, will aim to get all the examples updated. To anyone reading this, we will always be happy to accept updates to our examples! |
Hi there
I am currently trying to get the gRPC plugin to work in a Docker container to generate a pact for a Go based application. The problem is that seemingly the mock server that should respond to the gRPC calls of my code is booted in a way that the actual test can not connect to it (or at least this my hypothesis from the logs that I saw). I already tried setting the
hostToBindTo
parameter in thepact-plugin.json
, but this had no effect and the test crashed again.The definition for my container looks like this
When I build the image and start a container the
pact-plugin.json
looks like this:Which looks like the config described in the README that one should use for a Docker based environment.
When I start the test for go-consumer of the area calculator within the container, instead of generating the pact, I receive the following logs and pact crashes:
I currently don't know if I forgot to configure something the right way or if this is some kind of networking error.
I hope I provided all the necessary info. Thanks for looking into it!
The text was updated successfully, but these errors were encountered: