pact-go: Expectation failures should be reported on all pact URLs, not just on the first one
Software versions
-
OS: macOS High Sierra 10.13.5
-
Consumer Pact library: Pact Go CLI v1.0.0-beta.1, using CLI tools version 1.44.1
-
Provider Pact library:
$ pact-mock-service version 2.8.0 $ pact-provider-verifier version 1.14.3 $ pact-broker version 1.14.1 -
Golang Version:
go version go1.10.1 darwin/amd64 -
Golang environment:
GOARCH="amd64" GOBIN="" GOCACHE="/Users/alex/Library/Caches/go-build" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/alex/Documents/source/go" GORACE="" GOROOT="/usr/local/Cellar/go/1.10.1/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.10.1/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/5v/fvbqg92n7wg1vkr3gg4glvyh0000gn/T/go-build696986998=/tmp/go-build -gno-record-gcc-switches -fno-common"
Expected behaviour
- Call verify provider with more than one pact URL
- Expectation failures should be reported on all pacts
Actual behaviour
It the first pact succeeds expectation failures on all subsequent pacts are ignored
Steps to reproduce
res, _ := pact.VerifyProviderRaw(types.VerifyRequesttypes.VerifyRequest{
ProviderBaseURL: "http://localhost:9001",
PactURLs: []string{
filepath.Join(test.GetPactsDir(), "agent-desktop-auth.json"), // succeeding
filepath.Join(test.GetPactsDir(), "api-auth.json"), // failing
},
ProviderStatesSetupURL: "http://localhost:9001/setup-pacts",
})
Relevant log files
Running pacts by hand with pact-provider-verifier shows that the result for the first pact URL go to stdout:
{
"version": "3.7.1",
"examples": [
{
"id": "/opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.26.0/lib/pact/provider/rspec.rb[1:1:1:1:1:1]",
"description": "has status code 200",
"full_description": "Verifying a pact between agent-desktop and auth Given michelle.smith exists in example.com org create desktop token with POST /api/v3/desktop_tokens returns a response which has status code 200",
"status": "passed",
"file_path": "/opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.26.0/lib/pact/provider/rspec.rb",
"line_number": 148,
"run_time": 0.030802,
"pending_message": null
},
// ... cut ...
],
"summary": {
"duration": 0.038427,
"example_count": 6,
"failure_count": 0,
"pending_count": 0,
"errors_outside_of_examples_count": 0
},
"summary_line": "6 examples, 0 failures"
}
while failures for the second pact URL go to stderr:
{
"version": "3.7.1",
"examples": [
{
"id": "/opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.26.0/lib/pact/provider/rspec.rb[1:1:1:1:1:1]",
"description": "has status code 200",
"full_description": "Verifying a pact between api and auth Given michelle.smith exists in example.com org get existing user from API token with POST /api/v1/api_users returns a response which has status code 200",
"status": "failed",
"file_path": "/opt/pact/lib/vendor/ruby/2.2.0/gems/pact-1.26.0/lib/pact/provider/rspec.rb",
"line_number": 148,
"run_time": 0.008817,
"pending_message": null,
"exception": {
"class": "RSpec::Expectations::ExpectationNotMetError",
"message": "\nexpected: 200\n got: 404\n\n(compared using eql?)\n",
"backtrace": [
"/opt/pact/lib/vendor/ruby/2.2.0/gems/rspec-support-3.7.1/lib/rspec/support.rb:97:in `block in <module:Support>'",
"/opt/pact/lib/vendor/ruby/2.2.0/gems/rspec-support-3.7.1/lib/rspec/support.rb:106:in `call'",
"/opt/pact/lib/vendor/ruby/2.2.0/gems/rspec-support-3.7.1/lib/rspec/support.rb:106:in `notify_failure'",
// ... cut ....
],
"summary": {
"duration": 0.017386,
"example_count": 4,
"failure_count": 2,
"pending_count": 0,
"errors_outside_of_examples_count": 0
},
"summary_line": "4 examples, 2 failures"
}
It appears that stderr is ignored by the client.go, only stdout is processed
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (11 by maintainers)
Commits related to this issue
- feat: print a new line between JSON documents when using --format json This allows the stream to be parsed as jsonl Fixes: https://github.com/pact-foundation/pact-go/issues/88 — committed to pact-foundation/pact-provider-verifier by bethesque 6 years ago
- feat(verifications): parse multiple verifications into tests. Fixes #88 — committed to pact-foundation/pact-go by mefellows 6 years ago
Latest release is out @alexeits - tag is
v1.0.0-beta.1or you can pin to the current git sha.Let us know how you go!
@bethesque, @mefellows thanks a lot for the quick turnaround. The responsiveness of your team is amazing.
Hm. That could work. I’d need to make a modification somewhere to add the new line in, but that shouldn’t be too hard.