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

More than one consumer causes VerifyProvider to fail when specifying BrokerURL #75

Closed
sugarjig opened this issue Mar 30, 2018 · 8 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@sugarjig
Copy link

Software versions

  • OS: Mac OSX 10.13.3, Ubuntu 14.04
  • Consumer Pact library: pact-foundation/pact 5.3.2, pact-foundation/pact-node 6.7.3, pact-consumer-swift 0.5.1
  • Provider Pact library: pact-go 0.0.11
  • Golang Version: 1.10
  • Golang environment:
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/username/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/username/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/80/8lv857_55gv0xtvl97bwvn4c0000gp/T/go-build315953557=/tmp/go-build -gno-record-gcc-switches -fno-common"

Expected behaviour

When calling pact.VerifyProvider and passing in a types.VerifyRequest with BrokerURL specified, I expect that if the broker contains pacts from more than one consumer for this provider, each pact will be verified.

Actual behaviour

When running the test, I see the following output:

        pact.go:264: Error: error verifying provider: exit status 1
                
                STDERR:
                Error reading file from https://<broker-url>/pacts/provider/provider-name/consumer/consumer1-name/version/1.12.0 https://<broker-url>/pacts/provider/provider-name/consumer/consumer2-name/version/1.19.0
                bad URI(is not URI?): https://<broker-url>/pacts/provider/provider-name/consumer/consumer1-name/version/1.12.0 https://<broker-url>/pacts/provider/provider-name/consumer/consumer2-name/version/1.19.0 /Users/username/go/src/github.com/org/repo/pact/lib/ruby/lib/ruby/2.2.0/uri/rfc3986_parser.rb:66:in `split'
                /Users/username/go/src/github.com/org/repo/pact/lib/ruby/lib/ruby/2.2.0/uri/rfc3986_parser.rb:72:in `parse'
                /Users/username/go/src/github.com/org/repo/pact/lib/ruby/lib/ruby/2.2.0/uri/common.rb:226:in `parse'
                /Users/username/go/src/github.com/org/repo/pact/lib/ruby/lib/ruby/2.2.0/uri/common.rb:713:in `URI'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.2.4/lib/pact/consumer_contract/pact_file.rb:39:in `render_pact'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.2.4/lib/pact/consumer_contract/pact_file.rb:22:in `read'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_source.rb:14:in `pact_json'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_spec_runner.rb:129:in `collect'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_spec_runner.rb:129:in `pact_jsons'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_spec_runner.rb:92:in `configure_rspec'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_spec_runner.rb:33:in `run'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/cli/run_pact_verification.rb:61:in `run_with_pact_uri'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/cli/run_pact_verification.rb:49:in `run_specs'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/cli/run_pact_verification.rb:22:in `call'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/cli/run_pact_verification.rb:14:in `call'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:107:in `verify_pact'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:28:in `block in call'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:27:in `collect'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:27:in `call'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:21:in `call'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/cli/verify.rb:26:in `verify'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
                /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
                /Users/username/go/src/github.com/org/repo/pact/lib/app/pact-provider-verifier.rb:2:in `<main>'
                /Users/username/go/src/github.com/org/repo/pact/lib/ruby/lib/ruby/2.2.0/uri/rfc3986_parser.rb:66:in `split': bad URI(is not URI?): https://<broker-url>/pacts/provider/provider-name/consumer/consumer1-name/version/1.12.0 https://<broker-url>/pacts/provider/provider-name/consumer/consumer2-name/version/1.19.0 (URI::InvalidURIError)
                        from /Users/username/go/src/github.com/org/repo/pact/lib/ruby/lib/ruby/2.2.0/uri/rfc3986_parser.rb:72:in `parse'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/ruby/lib/ruby/2.2.0/uri/common.rb:226:in `parse'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/ruby/lib/ruby/2.2.0/uri/common.rb:713:in `URI'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.2.4/lib/pact/consumer_contract/pact_file.rb:39:in `render_pact'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.2.4/lib/pact/consumer_contract/pact_file.rb:22:in `read'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_source.rb:14:in `pact_json'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_spec_runner.rb:129:in `collect'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_spec_runner.rb:129:in `pact_jsons'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_spec_runner.rb:92:in `configure_rspec'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/provider/pact_spec_runner.rb:33:in `run'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/cli/run_pact_verification.rb:61:in `run_with_pact_uri'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/cli/run_pact_verification.rb:49:in `run_specs'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/cli/run_pact_verification.rb:22:in `call'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-1.20.0/lib/pact/cli/run_pact_verification.rb:14:in `call'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:107:in `verify_pact'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:28:in `block in call'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:27:in `collect'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:27:in `call'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/app.rb:21:in `call'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/cli/verify.rb:26:in `verify'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.11.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
                        from /Users/username/go/src/github.com/org/repo/pact/lib/app/pact-provider-verifier.rb:2:in `<main>'

Steps to reproduce

pact := &dsl.Pact{
	Port:     6666,
	Provider: "provider-name",
}
mockPort := ":6667"
providerStatesSetupPath := "/setup"
go startServer(t, mockPort)
pact.VerifyProvider(t, types.VerifyRequest{
	ProviderBaseURL:            "http://localhost" + mockPort,
	ProviderStatesSetupURL:     "http://localhost" + mockPort + providerStatesSetupPath,
	BrokerURL:                  os.Getenv("PACT_BROKER_BASE_URL"),
	BrokerUsername:             os.Getenv("PACT_BROKER_USERNAME"),
	BrokerPassword:             os.Getenv("PACT_BROKER_PSWD"),
	PublishVerificationResults: publishResults,
	ProviderVersion:            providerVersion,
})
@sugarjig sugarjig changed the title More than one consumer causes provider tests to fail when specifying BrokerURL More than one consumer causes VerifyProvider to fail when specifying BrokerURL Mar 30, 2018
@mefellows
Copy link
Member

Thanks @sugarjig, will take a look.

@mefellows
Copy link
Member

Hi @sugarjig, I've pushed a fix for this. Could you please take a look at https://github.com/pact-foundation/pact-go/releases/tag/v0.0.12 and see if it addresses your issue?

The pact integration test just verified a new consumer I added to the broker, so this confirms that we can verify multiple consumers now.

@mefellows mefellows added bug Indicates an unexpected problem or unintended behavior awaiting feedback and removed triage labels Mar 31, 2018
@sugarjig
Copy link
Author

sugarjig commented Apr 2, 2018

Thanks! I will give it a try. Any idea when v0.0.12 will be finalized? I have noticed that the tag keeps moving...

@sugarjig
Copy link
Author

sugarjig commented Apr 2, 2018

The fix worked! I think until v0.0.12 is finalized, and the tag is stable, we can't update. We have a workaround where we're specifying the consumers, and calling VerifyProvider for each one.

@mefellows
Copy link
Member

Great! I was just waiting confirmation, I'll push out a stable release today.

@mefellows
Copy link
Member

I've released v0.0.12 now, the tag won't move.

FYI going forward no tags should move as the build /release process is drastically changing.

Also if you're keen, checkout v0.0.13-beta which is a new daemonless branch and will have support for async messaging.

@sugarjig
Copy link
Author

sugarjig commented Apr 3, 2018

Awesome! Daemonless operation sounds great. I'll have to give it a try. Thanks again!

@mefellows
Copy link
Member

Thanks - feedback welcome. We have a Slack channel pact-foundation.slack.com where you can chat with us (moving away from Gitter), let us know if you'd like an invite (we don't have an auto-invite thing setup just yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants