pact-foundation / pact-go

Golang version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
http://pact.io
MIT License
834 stars 104 forks source link

Deadlock on running pact provider verification #128

Closed Jarema closed 4 years ago

Jarema commented 4 years ago

Software versions

Expected behaviour

No deadlock, erronous contracts are failing, no useful logs

Actual behaviour

Running pact provider verification against pact broker started to deadlock itself. There are no logs that can hint to the right direction

Steps to reproduce

Thats the biggest issue: I'm not even able to reproduce for you, as I have no idea which contract is causing this. Cutting all contracts and adding one by one works. Its increadibly time consuming to find broken contract in such manual fashion, as there are hundreds of them.

Relevent log files

stack trace:

panic: test timed out after 10m0s

goroutine 782 [running]:
testing.(*M).startAlarm.func1()
    /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1460 +0xdf
created by time.goFunc
    /usr/local/Cellar/go/1.14/libexec/src/time/sleep.go:168 +0x44

goroutine 1 [chan receive, 10 minutes]:
testing.(*T).Run(0xc000362900, 0x4dd7604, 0xc, 0x4e230a8, 0x408f4e6)
    /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1044 +0x37e
testing.runTests.func1(0xc000362480)
    /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1285 +0x78
testing.tRunner(0xc000362480, 0xc00077be10)
    /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0xdc
testing.runTests(0xc000371040, 0x57f7fb0, 0x1, 0x1, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1283 +0x2a7
testing.(*M).Run(0xc00009f980, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1200 +0x15f
main.main()
    _testmain.go:44 +0x135

goroutine 35 [select]:
go.opencensus.io/stats/view.(*worker).start(0xc000296e10)
    /Users/name/go/pkg/mod/go.opencensus.io@v0.22.3/stats/view/worker.go:154 +0x100
created by go.opencensus.io/stats/view.init.0
    /Users/name/go/pkg/mod/go.opencensus.io@v0.22.3/stats/view/worker.go:32 +0x57

goroutine 39 [select]:
go.elastic.co/apm.(*Tracer).loop(0xc000001800)
    /Users/name/go/pkg/mod/go.elastic.co/apm@v1.7.0/tracer.go:768 +0xab0
created by go.elastic.co/apm.newTracer
    /Users/name/go/pkg/mod/go.elastic.co/apm@v1.7.0/tracer.go:410 +0x76c

goroutine 24 [select]:
go.elastic.co/apm.(*Tracer).loop.func1(0xc0000b6120, 0x4fd3300, 0xc0000a9bc0, 0xc000092b40, 0xc000001800, 0xc0000a4518)
    /Users/name/go/pkg/mod/go.elastic.co/apm@v1.7.0/tracer.go:713 +0x2cf
created by go.elastic.co/apm.(*Tracer).loop
    /Users/name/go/pkg/mod/go.elastic.co/apm@v1.7.0/tracer.go:709 +0x33f

goroutine 4 [select, 5 minutes]:
go.elastic.co/apm/transport.(*HTTPTransport).WatchConfig.func1(0xc0001001e0, 0x4fd3300, 0xc00059cac0, 0xc00016ea80, 0xc00024bb40, 0x9, 0x0, 0x0)
    /Users/name/go/pkg/mod/go.elastic.co/apm@v1.7.0/transport/http.go:386 +0x1db
created by go.elastic.co/apm/transport.(*HTTPTransport).WatchConfig
    /Users/name/go/pkg/mod/go.elastic.co/apm@v1.7.0/transport/http.go:378 +0xae

goroutine 5 [IO wait, 9 minutes]:
internal/poll.runtime_pollWait(0xd410e50, 0x72, 0xffffffffffffffff)
    /usr/local/Cellar/go/1.14/libexec/src/runtime/netpoll.go:203 +0x55
internal/poll.(*pollDesc).wait(0xc0030d0858, 0x72, 0xf501, 0xf557, 0xffffffffffffffff)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc0030d0840, 0xc0038388a9, 0xf557, 0xf557, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_unix.go:169 +0x201
os.(*File).read(...)
    /usr/local/Cellar/go/1.14/libexec/src/os/file_unix.go:263
os.(*File).Read(0xc004444138, 0xc0038388a9, 0xf557, 0xf557, 0xaa9, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/os/file.go:116 +0x71
bytes.(*Buffer).ReadFrom(0xc00269a628, 0x4fb46a0, 0xc004444138, 0x4fb46a0, 0x4e26c58, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/bytes/buffer.go:204 +0xb1
io/ioutil.readAll(0x4fb46a0, 0xc004444138, 0x200, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/io/ioutil/ioutil.go:36 +0xe3
io/ioutil.ReadAll(...)
    /usr/local/Cellar/go/1.14/libexec/src/io/ioutil/ioutil.go:45
github.com/pact-foundation/pact-go/dsl.(*PactClient).VerifyProvider(0xc003b52300, 0xc004692240, 0x16, 0x0, 0x0, 0x0, 0xc00003e099, 0x1f, 0x0, 0x0, ...)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/dsl/client.go:186 +0x371
github.com/pact-foundation/pact-go/dsl.(*Pact).VerifyProviderRaw(0xc000dbf4b8, 0xc0047cf3a0, 0x15, 0x0, 0x0, 0x0, 0xc00003e099, 0x1f, 0x0, 0x0, ...)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/dsl/pact.go:392 +0x8c0
github.com/pact-foundation/pact-go/dsl.(*Pact).VerifyProvider(0xc000dbf4b8, 0xc000362900, 0xc0047cf3a0, 0x15, 0x0, 0x0, 0x0, 0xc00003e099, 0x1f, 0x0, ...)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/dsl/pact.go:399 +0x70
command-line-arguments.TestProvider(0xc000362900)
    /Users/name/coding/app_v2/tests/pact/provider_test.go:159 +0x12d3
testing.tRunner(0xc000362900, 0x4e230a8)
    /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0xdc
created by testing.(*T).Run
    /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1043 +0x357

goroutine 12 [chan send, 9 minutes]:
command-line-arguments.waitForProvider.func1(0x6fc23ac00, 0xc0040d79e0)
    /Users/name/coding/app_v2/tests/pact/provider_test.go:234 +0x5d
created by command-line-arguments.waitForProvider
    /Users/name/coding/app_v2/tests/pact/provider_test.go:232 +0x7c

goroutine 11 [IO wait, 9 minutes]:
internal/poll.runtime_pollWait(0xd411550, 0x72, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/runtime/netpoll.go:203 +0x55
internal/poll.(*pollDesc).wait(0xc00519a618, 0x72, 0x0, 0x0, 0x4dd031f)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Accept(0xc00519a600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_unix.go:384 +0x1d4
net.(*netFD).accept(0xc00519a600, 0x34b3ea1c, 0xaad34b3ea1c, 0x100000001)
    /usr/local/Cellar/go/1.14/libexec/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc0051a66e0, 0x5e9d65bb, 0xc0006718e8, 0x408f4e6)
    /usr/local/Cellar/go/1.14/libexec/src/net/tcpsock_posix.go:139 +0x32
net.(*TCPListener).Accept(0xc0051a66e0, 0xc000671938, 0x18, 0xc000104f00, 0x433871c)
    /usr/local/Cellar/go/1.14/libexec/src/net/tcpsock.go:261 +0x64
net/http.(*Server).Serve(0xc002f27b20, 0x4fce8c0, 0xc0051a66e0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:2901 +0x25d
net/http.(*Server).ListenAndServe(0xc002f27b20, 0xc002f27b20, 0xc000671ac8)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:2830 +0xb7
net/http.ListenAndServe(...)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:3086
github.com/gin-gonic/gin.(*Engine).Run(0xc00508c500, 0xc000671b78, 0x1, 0x1, 0x0, 0x0)
    /Users/name/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/gin.go:295 +0x14d
ourrepo.net/company/app/app_v2/v2/web.StartRouter(0x4fd3340, 0xc00011e008, 0x4fdccc0, 0xc000665d70, 0xc00508c500, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /Users/name/coding/app_v2/web/router.go:244 +0x3d4
created by command-line-arguments.TestProvider
    /Users/name/coding/app_v2/tests/pact/provider_test.go:132 +0xd3d

goroutine 27 [select, 9 minutes]:
net/http.(*persistConn).readLoop(0xc00014a5a0)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/transport.go:2099 +0x99e
created by net/http.(*Transport).dialConn
    /usr/local/Cellar/go/1.14/libexec/src/net/http/transport.go:1647 +0xc56

goroutine 28 [select, 9 minutes]:
net/http.(*persistConn).writeLoop(0xc00014a5a0)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/transport.go:2277 +0x11c
created by net/http.(*Transport).dialConn
    /usr/local/Cellar/go/1.14/libexec/src/net/http/transport.go:1648 +0xc7b

goroutine 41 [IO wait, 9 minutes]:
internal/poll.runtime_pollWait(0xd411390, 0x72, 0xffffffffffffffff)
    /usr/local/Cellar/go/1.14/libexec/src/runtime/netpoll.go:203 +0x55
internal/poll.(*pollDesc).wait(0xc003b52198, 0x72, 0x1000, 0x1000, 0xffffffffffffffff)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc003b52180, 0xc000171000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_unix.go:169 +0x201
net.(*netFD).Read(0xc003b52180, 0xc000171000, 0x1000, 0x1000, 0x3, 0x0, 0x4117122)
    /usr/local/Cellar/go/1.14/libexec/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc004444010, 0xc000171000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/net/net.go:184 +0x8e
net/http.(*connReader).Read(0xc0003300f0, 0xc000171000, 0x1000, 0x1000, 0xd65ea68, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:786 +0xf4
bufio.(*Reader).fill(0xc0036c54a0)
    /usr/local/Cellar/go/1.14/libexec/src/bufio/bufio.go:100 +0x103
bufio.(*Reader).ReadSlice(0xc0036c54a0, 0x403fa0a, 0xd65ea68, 0xc0006739c0, 0x400ea96, 0xc002806400, 0x100)
    /usr/local/Cellar/go/1.14/libexec/src/bufio/bufio.go:359 +0x3d
bufio.(*Reader).ReadLine(0xc0036c54a0, 0xc0006739c8, 0x5817d60, 0x5c007d0, 0x0, 0x1, 0xc00008f000)
    /usr/local/Cellar/go/1.14/libexec/src/bufio/bufio.go:388 +0x34
net/textproto.(*Reader).readLineSlice(0xc000330120, 0xc002806400, 0x0, 0x5817d60, 0xc000673a58, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/net/textproto/reader.go:58 +0x6c
net/textproto.(*Reader).ReadLine(...)
    /usr/local/Cellar/go/1.14/libexec/src/net/textproto/reader.go:39
net/http.readRequest(0xc0036c54a0, 0x0, 0xc002806400, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/request.go:1015 +0xa4
net/http.(*conn).readRequest(0xc004296140, 0x4fd3300, 0xc0046b6100, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:966 +0x191
net/http.(*conn).serve(0xc004296140, 0x4fd3300, 0xc0046b6100)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:1822 +0x6d4
created by net/http.(*Server).Serve
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:2933 +0x35c

goroutine 45 [chan receive, 9 minutes]:
github.com/pact-foundation/pact-go/client.(*ServiceManager).addServiceMonitor(0xc0002e4070)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:40 +0x8b
created by github.com/pact-foundation/pact-go/client.(*ServiceManager).Setup
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:31 +0x10e

goroutine 46 [chan receive, 9 minutes]:
github.com/pact-foundation/pact-go/client.(*ServiceManager).removeServiceMonitor(0xc0002e4070)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:54 +0x8b
created by github.com/pact-foundation/pact-go/client.(*ServiceManager).Setup
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:32 +0x130

goroutine 47 [chan receive, 9 minutes]:
github.com/pact-foundation/pact-go/client.(*ServiceManager).addServiceMonitor(0xc0002e40e0)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:40 +0x8b
created by github.com/pact-foundation/pact-go/client.(*ServiceManager).Setup
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:31 +0x10e

goroutine 48 [chan receive, 9 minutes]:
github.com/pact-foundation/pact-go/client.(*ServiceManager).removeServiceMonitor(0xc0002e40e0)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:54 +0x8b
created by github.com/pact-foundation/pact-go/client.(*ServiceManager).Setup
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:32 +0x130

goroutine 49 [chan receive, 9 minutes]:
github.com/pact-foundation/pact-go/client.(*ServiceManager).addServiceMonitor(0xc0002e41c0)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:40 +0x8b
created by github.com/pact-foundation/pact-go/client.(*ServiceManager).Setup
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:31 +0x10e

goroutine 82 [chan receive, 9 minutes]:
github.com/pact-foundation/pact-go/client.(*ServiceManager).removeServiceMonitor(0xc0002e41c0)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:54 +0x8b
created by github.com/pact-foundation/pact-go/client.(*ServiceManager).Setup
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:32 +0x130

goroutine 83 [chan receive, 9 minutes]:
github.com/pact-foundation/pact-go/client.(*ServiceManager).addServiceMonitor(0xc0002e42a0)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:40 +0x8b
created by github.com/pact-foundation/pact-go/client.(*ServiceManager).Setup
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:31 +0x10e

goroutine 84 [chan receive, 9 minutes]:
github.com/pact-foundation/pact-go/client.(*ServiceManager).removeServiceMonitor(0xc0002e42a0)
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:54 +0x8b
created by github.com/pact-foundation/pact-go/client.(*ServiceManager).Setup
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/client/service_manager.go:32 +0x130

goroutine 89 [IO wait, 9 minutes]:
internal/poll.runtime_pollWait(0xd4112b0, 0x72, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/runtime/netpoll.go:203 +0x55
internal/poll.(*pollDesc).wait(0xc003b52698, 0x72, 0x0, 0x0, 0x4dd031f)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Accept(0xc003b52680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/internal/poll/fd_unix.go:384 +0x1d4
net.(*netFD).accept(0xc003b52680, 0x56a5ec02347d6e20, 0xaad347d6e20, 0x100000001)
    /usr/local/Cellar/go/1.14/libexec/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc00483e5a0, 0x5e9d65bb, 0xc000061de8, 0x408f4e6)
    /usr/local/Cellar/go/1.14/libexec/src/net/tcpsock_posix.go:139 +0x32
net.(*TCPListener).Accept(0xc00483e5a0, 0xc000061e38, 0x18, 0xc000083500, 0x433871c)
    /usr/local/Cellar/go/1.14/libexec/src/net/tcpsock.go:261 +0x64
net/http.(*Server).Serve(0xc002f260e0, 0x4fce8c0, 0xc00483e5a0, 0x0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:2901 +0x25d
net/http.(*Server).ListenAndServe(0xc002f260e0, 0xc002f260e0, 0x0)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:2830 +0xb7
net/http.ListenAndServe(0xc0046c04e0, 0x6, 0x4fb5760, 0xc000330960, 0x6, 0x2)
    /usr/local/Cellar/go/1.14/libexec/src/net/http/server.go:3086 +0x74
created by github.com/pact-foundation/pact-go/proxy.HTTPReverseProxy
    /Users/name/go/pkg/mod/github.com/pact-foundation/pact-go@v1.3.0/proxy/http.go:102 +0x397
FAIL    command-line-arguments  600.056s
FAIL

logs:

There are many of those, but all looks similar.

#4524]  INFO -- : Running example 'Verifying a pact between ***-app and Given state A request to /v1/endpoint POST /v1/flows/endpoint returns a response which has status code 200'
I, [2020-04-20T11:04:59.558413 #4524]  INFO -- : Sending POST request to path: "/v1/endpoint" with headers: {"HTTP_X_REQUEST_ID"=>"45213CdB-bcDF-Ce83-A9D5-bbC19E91C75b", "CONTENT_TYPE"=>"application/json", "HTTP_X_PACT_ORIGINAL_HEADER_NAMES"=>"X-Request-Id,Content-Type", "X_PACT_PROVIDER_STATES"=>[{"name"=>"state"}]}, see debug logs for body
D, [2020-04-20T11:04:59.558477 #4524] DEBUG -- : body :{"name":"data"}
I, [2020-04-20T11:04:59.565526 #4524]  INFO -- : Received response with status: 200, headers: {"Content-Length"=>"218", "Content-Type"=>"application/json; charset=utf-8", "Date"=>"Mon, 20 Apr 2020 09:04:59 GMT"}, see debug logs for body
D, [2020-04-20T11:04:59.565596 #4524] DEBUG -- : body: {"id":"5","status":200,"timestamp":"2020-04-20T11:04:59.564795+02:00"}
mefellows commented 4 years ago

Sorry to hear this! Thanks for the report. I'll have a look at some of the areas that may be responsible for a deadlock, that may be a starting point.

Are you able to share anything about the test setup that could be helpful?

If you set the log level to debug you should get more output to the terminal that may help - feel free to post the whole thing and we can dig through it.

Jarema commented 4 years ago

I will provide logs a little later, when I anonymise them.

About setup:

EDIT: All worked as intened until recently, when it started hitting that deadlock.

Jarema commented 4 years ago

additional logs (anonymised)

env PACT_URL=https://pact.non-prd.org.net  env VERSION=2.114.0 PACT_USERNAME=xxx env PACT_PASSWORD=xxx env PACT_PUBLISH_VERIFICATION_RESULT=true go test -tags=pact -v ./tests/pact/provider_test.go
=== RUN   TestProvider
12:55PM INF services initialized, initializing customers service_name=app version=2.114.0
12:55PM INF setting up server service_name=app version=2.114.0
12:55PM ERR The flag false has to be removed from configuration after date 2020-01-06 00:00:00 +0000 UTC service_name=app version=2.114.0
12:55PM INF With specific config for current environment:
 service_name=app version=2.114.0
12:55PM WRN starting router WITHOUT authentication middleware service_name=app version=2.114.0
12:55PM WRN starting router WITHOUT authentication middleware service_name=app version=2.114.0
12:55PM WRN starting router WITHOUT authentication middleware service_name=app version=2.114.0
12:55PM WRN starting router WITHOUT authentication middleware service_name=app version=2.114.0
12:55PM WRN attempt to start a router without TLS support service_name=app version=2.114.0
    TestProvider: provider_test.go:238: checking if router is running
12:55PM INF handled http request client_ip=::1 duration=0.105 method=GET path=/v1/app/path
    TestProvider: provider_test.go:248: router started
12:55PM INF laoding states service_name=app version=2.114.0
12:55PM INF states loaded service_name=app version=2.114.0
12:55PM INF start provider verification service_name=app version=2.114.0
[DEBUG] pact setup logging
[DEBUG] pact setup
[DEBUG] checking CLI compatability
[INFO] checking pact-mock-service within range >= 3.5.0, < 4.0.0
[DEBUG] running binary pact-mock-service
[DEBUG] checking version for binary pact-mock-service version 3.6.0
[DEBUG] checking if version 3.6.0 within semver range >= 3.5.0, < 4.0.0
[DEBUG] 3.6.0 satisfies constraints 3.6.0 >= 3.5.0, < 4.0.0
[INFO] checking pact-provider-verifier within range >= 1.30.0, < 2.0.0
[DEBUG] running binary pact-provider-verifier
[DEBUG] checking version for binary pact-provider-verifier version 1.30.0
[DEBUG] checking if version 1.30.0 within semver range >= 1.30.0, < 2.0.0
[DEBUG] 1.30.0 satisfies constraints 1.30.0 >= 1.30.0, < 2.0.0
[INFO] checking pact-broker within range >= 1.22.3
[DEBUG] running binary pact-broker
[DEBUG] checking version for binary pact-broker version 1.25.1
[DEBUG] checking if version 1.25.1 within semver range >= 1.22.3
[DEBUG] 1.25.1 satisfies constraints 1.25.1 >= 1.22.3
[DEBUG] setting up a service manager
[DEBUG] setting up a service manager
[DEBUG] setting up a service manager
[DEBUG] setting up a service manager
[DEBUG] starting service removal monitor
[DEBUG] starting service creation monitor
[DEBUG] starting service creation monitor
[DEBUG] starting service removal monitor
[DEBUG] starting service creation monitor
[DEBUG] starting service removal monitor
[DEBUG] starting service creation monitor
[DEBUG] starting service removal monitor
[DEBUG] starting new proxy with opts {http localhost:8085  0 [0x4420190] /__setup <nil>}
[DEBUG] starting reverse proxy on port 56827
[DEBUG] waiting for port 56827 to become available
[DEBUG] pact provider verification
[DEBUG] client: verifying a provider
[DEBUG] waiting for port 56827 to become available
[DEBUG] starting verification service with args: [--custom-provider-header X-Request-Id: 32758736-cfd4-4874-9110-975947c99bb7 --format json --provider-base-url http://localhost:56827 --provider-states-setup-url http://localhost:56827/__setup --broker-username xxx --broker-password xxx --pact-broker-base-url https://pact.non-prd.org.net --provider_app_version 2.114.0 --provider app --publish_verification_results true]
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56835 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=1.177871 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56842 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
INF Evaluating node XXXX data
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF handled http request client_ip=127.0.0.1   duration=2.408147 flow_execution_summary=[{"exit_id":"60","flow_id":"xxx","order":1,"path":""}] flow_id=xxx method=POST path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56845 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.244352 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56848 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.175314 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56851 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.30711 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56854 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.281221 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56859 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.154285 method=GET path=/v1/app/path
[WARN] state handler not found for state:
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56866 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM WRN  error="customer not found" requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
12:55PM WRN handled http request client_ip=127.0.0.1 duration=0.321454 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56871 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.2489 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56876 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.182651 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56879 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=2.141458 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56885 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.19419 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56891 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.434439 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56896 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.115197 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56901 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.193961 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56904 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.125048 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56907 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.097459 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56910 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
INF Evaluating node XXXX data
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF Evaluating node: XXX-node
12:55PM INF handled http request client_ip=127.0.0.1   duration=1.265109 flow_execution_summary=[{"exit_id":"10","flow_id":"xxx","order":1,"path":"xxx"}] flow_id=xxx method=POST path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56913 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.138764 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56916 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.132246 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56919 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.771945 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56922 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.689886 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56925 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=1.28551 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56928 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.260811 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56931 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.172031 method=GET path=/v1/app/path
12:55PM INF load state: state-name service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56934 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=0.381242 method=GET path=/v1/app/path
[WARN] state handler not found for state: retail-with-premium-package
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:56937 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
12:55PM INF handled http request client_ip=127.0.0.1   duration=2.311325 flow_execution_summary=[] flow_id=xxx method=POST path=/v1/app/path
mefellows commented 4 years ago

Thanks for that - are you able to share the anonymised provider test also? I suspect it won't change much, but best to rule it out too.

Jarema commented 4 years ago

also: anonymised test run for same setup, just different provider name (I added in broker just sample consumer contract that I know is correct):

== RUN   TestProvider
1:10PM INF services initialized, initializing customers service_name=app version=2.114.0
1:10PM INF setting up server service_name=app version=2.114.0
1:10PM ERR The flag false has to be removed from configuration after date 2020-01-06 00:00:00 +0000 UTC service_name=app version=2.114.0
 service_name=app version=2.114.0
1:10PM WRN starting router WITHOUT authentication middleware service_name=app version=2.114.0
1:10PM WRN starting router WITHOUT authentication middleware service_name=app version=2.114.0
1:10PM WRN starting router WITHOUT authentication middleware service_name=app version=2.114.0
1:10PM WRN starting router WITHOUT authentication middleware service_na§me=app version=2.114.0
1:10PM WRN attempt to start a router without TLS support service_name=app version=2.114.0
    TestProvider: provider_test.go:238: checking if router is running
1:10PM INF handled http request client_ip=::1 duration=0.365994 method=GET path=/v1/app/path requestID=aa3fe223-9c7e-4439-822d-cf9be7b21771 request_protocol=HTTP/1.1 service_name=app status=200 user_agent=Go-http-client/1.1 version=2.114.0
    TestProvider: provider_test.go:248: router started
1:10PM INF ladoing states service_name=app version=2.114.0
1:10PM INF states loaded service_name=app version=2.114.0
1:10PM INF start provider verification service_name=app version=2.114.0
[DEBUG] pact setup logging
[DEBUG] pact setup
[DEBUG] checking CLI compatability
[INFO] checking pact-mock-service within range >= 3.5.0, < 4.0.0
[DEBUG] running binary pact-mock-service
[DEBUG] checking version for binary pact-mock-service version 3.6.0
[DEBUG] checking if version 3.6.0 within semver range >= 3.5.0, < 4.0.0
[DEBUG] 3.6.0 satisfies constraints 3.6.0 >= 3.5.0, < 4.0.0
[INFO] checking pact-provider-verifier within range >= 1.30.0, < 2.0.0
[DEBUG] running binary pact-provider-verifier
[DEBUG] checking version for binary pact-provider-verifier version 1.30.0
[DEBUG] checking if version 1.30.0 within semver range >= 1.30.0, < 2.0.0
[DEBUG] 1.30.0 satisfies constraints 1.30.0 >= 1.30.0, < 2.0.0
[INFO] checking pact-broker within range >= 1.22.3
[DEBUG] running binary pact-broker
[DEBUG] checking version for binary pact-broker version 1.25.1
[DEBUG] checking if version 1.25.1 within semver range >= 1.22.3
[DEBUG] 1.25.1 satisfies constraints 1.25.1 >= 1.22.3
[DEBUG] setting up a service manager
[DEBUG] setting up a service manager
[DEBUG] setting up a service manager
[DEBUG] setting up a service manager
[DEBUG] starting service removal monitor
[DEBUG] starting service creation monitor
[DEBUG] starting service creation monitor
[DEBUG] starting service removal monitor
[DEBUG] starting service removal monitor
[DEBUG] starting service creation monitor
[DEBUG] starting service creation monitor
[DEBUG] starting service removal monitor
[DEBUG] starting new proxy with opts {http localhost:8085  0 [0x4420190] /__setup <nil>}
[DEBUG] starting reverse proxy on port 57061
[DEBUG] waiting for port 57061 to become available
[DEBUG] pact provider verification
[DEBUG] client: verifying a provider
[DEBUG] waiting for port 57061 to become available
[DEBUG] starting verification service with args: [--custom-provider-header X-Request-Id: 32758736-cfd4-4874-9110-975947c99bb7 --format json --provider-base-url http://localhost:57061 --provider-states-setup-url http://localhost:57061/__setup --broker-username pact --broker-password bDDpozTdP9y99KS7 --pact-broker-base-url https://pact.non-prd.org.net --provider_app_version 2.114.0 --provider app2 --publish_verification_results true]
1:10PM INF load state: retail-customer-with-card-token service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:57069 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
1:10PM INF handled http request client_ip=127.0.0.1   duration=2.86124   method=POST path=/v1/app/path requestID=32758736-cfd4-4874-9110-975947c99bb7 request_protocol=HTTP/1.1 service_name=app status=200 user_agent="Pact Go" version=2.114.0 x_forwarded_for="127.0.0.1, ::1"
1:10PM INF load state: retail-customer-with-card-token service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:57074 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
1:10PM WRN Validation failed! Dictionary name not provide   field_name=Status   requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app struct_type=*types.CardToken version=2.114.0
1:10PM INF Evaluating tree: 2A6B, flowID: tokenization   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_I_0 (Does the card exist)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_K_0 (Is the card not closed or restricted?)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_M_0 (Does the token exist?)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_O_0 (What is the customer package)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_Q_0 (Is it a joint type?)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_S_0 (Get number)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_U_0 (End of logic leading to result)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM ERR used not existing language error="dictionaryItem or dictionary not found"   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF handled http request client_ip=127.0.0.1   duration=2.170922    method=POST path=/v1/app/path requestID=32758736-cfd4-4874-9110-975947c99bb7 request_protocol=HTTP/1.1 service_name=app status=200 user_agent="Pact Go" version=2.114.0 x_forwarded_for="127.0.0.1, ::1"
1:10PM INF load state: retail-customer-with-card-token service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:57077 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
1:10PM WRN Validation failed! Dictionary name not provide   field_name=Status   requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app struct_type=*types.CardToken version=2.114.0
1:10PM INF Evaluating tree: 2A6B, flowID: tokenization   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_I_0 (Does the card exist)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_K_0 (Is the card not closed or restricted?)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_M_0 (Does the token exist?)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_O_0 (What is the customer package)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_Q_0 (Is it a joint type?)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_S_0 (Get number)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF Evaluating node: 2A6B_U_0 (End of logic leading to result)   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF handled http request client_ip=127.0.0.1   duration=1.564803  method=POST path=/v1/app/path requestID=32758736-cfd4-4874-9110-975947c99bb7 request_protocol=HTTP/1.1 service_name=app status=200 user_agent="Pact Go" version=2.114.0 x_forwarded_for="127.0.0.1, ::1"
1:10PM ERR used not existing language error="dictionaryItem or dictionary not found"   idempotence_key= requestID=32758736-cfd4-4874-9110-975947c99bb7 service_name=app version=2.114.0
1:10PM INF load state: retail-customer-with-card-token service_name=app version=2.114.0
[DEBUG] skipping state handler for request /v1/app/path
[DEBUG] http reverse proxy received connection from [::1]:57080 on path /v1/app/path
[DEBUG] setting proxy to target
[DEBUG] incoming request /v1/app/path
[DEBUG] outgoing request http://localhost:8085/v1/app/path
1:10PM INF handled http request client_ip=127.0.0.1   duration=0.603642 method=GET path=/v1/app/path requestID=32758736-cfd4-4874-9110-975947c99bb7 request_protocol=HTTP/1.1 service_name=app status=200 user_agent="Pact Go" version=2.114.0 x_forwarded_for="127.0.0.1, ::1"
=== RUN   TestProvider/Pact_between__and__
=== RUN   TestProvider/has_status_code_200
    TestProvider/has_status_code_200: pact.go:622: Verifying a pact between consumer-app and app2 state activate tokenization with POST /v1/app/path returns a response which has status code 200
=== RUN   TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"
    TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8": pact.go:622: Verifying a pact between consumer-app and app2 state activate tokenization with POST /v1/app/path returns a response which includes headers "Content-Type" which equals "application/json; charset=utf-8"
=== RUN   TestProvider/has_status_code_200#01
    TestProvider/has_status_code_200#01: pact.go:622: Verifying a pact between consumer-app and app2 state complete tokenization with POST /v1/app/path returns a response which has status code 200
=== RUN   TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#01
    TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#01: pact.go:622: Verifying a pact between consumer-app and app2 state complete tokenization with POST /v1/app/path returns a response which includes headers "Content-Type" which equals "application/json; charset=utf-8"
=== RUN   TestProvider/has_status_code_200#02
    TestProvider/has_status_code_200#02: pact.go:622: Verifying a pact between consumer-app and app2 state complete tokenization with nullable field with POST /v1/app/path returns a response which has status code 200
=== RUN   TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#02
    TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#02: pact.go:622: Verifying a pact between consumer-app and app2 state complete tokenization with nullable field with POST /v1/app/path returns a response which includes headers "Content-Type" which equals "application/json; charset=utf-8"
=== RUN   TestProvider/has_status_code_200#03
    TestProvider/has_status_code_200#03: pact.go:622: Verifying a pact between consumer-app and app2 state get cards by rbs with GET /v1/app/path returns a response which has status code 200
=== RUN   TestProvider/has_a_matching_body
    TestProvider/has_a_matching_body: pact.go:622: Verifying a pact between consumer-app and app2 state get cards by rbs with GET /v1/app/path returns a response which has a matching body
=== RUN   TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#03
    TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#03: pact.go:622: Verifying a pact between consumer-app and app2 state get cards by rbs with GET /v1/app/path returns a response which includes headers "Content-Type" which equals "application/json; charset=utf-8"
1:10PM INF pacts verification finished service_name=app version=2.114.0
--- PASS: TestProvider (10.40s)
    --- PASS: TestProvider/has_status_code_200 (0.00s)
    --- PASS: TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8" (0.00s)
    --- PASS: TestProvider/has_status_code_200#01 (0.00s)
    --- PASS: TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#01 (0.00s)
    --- PASS: TestProvider/has_status_code_200#02 (0.00s)
    --- PASS: TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#02 (0.00s)
    --- PASS: TestProvider/has_status_code_200#03 (0.00s)
    --- PASS: TestProvider/has_a_matching_body (0.00s)
    --- PASS: TestProvider/"Content-Type"_which_equals_"application/json;_charset=utf-8"#03 (0.00s)
    --- PASS: TestProvider/Pact_between__and__ (0.00s)
PASS
ok      command-line-arguments  10.451s
Jarema commented 4 years ago

stripped down code:

// +build pact

package pact

import (
    "context"
    "fmt"
    "github.com/coreos/etcd/pkg/fileutil"
    "github.com/pact-foundation/pact-go/dsl"
    "github.com/pact-foundation/pact-go/types"
    "github.com/spf13/afero"
    "github.com/stretchr/testify/require"
    "honnef.co/go/tools/config"
    "io"
    "net/http"
    "os"
    "path/filepath"
    "strconv"
    "testing"
    "time"
)

const (
    statesPath                     = "states"
    defaultPort                    = 8085
    defaultProvider                = "app"
    defaultWaitForProviderDuration = time.Second * 30
    pactUsernameEnv                = "PACT_USERNAME"
    pactPasswordEnv                = "PACT_PASSWORD"
    pactURLEnv                     = "PACT_URL"
    pactPublishVerificationEnv     = "PACT_PUBLISH_VERIFICATION_RESULT"
    providerVersionEnv             = "VERSION"
    tempStatePath                  = ".temp-state"
)

var dir, _ = os.Getwd()
var pactDir = fmt.Sprintf("%s/provider-pacts", dir)
var pactURL = os.Getenv(pactURLEnv)

// Provider Pact: How to run
// 2. go test -v -run TestProvider
func TestProvider(t *testing.T) {
    pactUsername := os.Getenv(pactUsernameEnv)
    pactPassword := os.Getenv(pactPasswordEnv)
    ctx := context.Background()

    // Create Pact connecting to local Daemon
    pact := &dsl.Pact{
        LogLevel:"DEBUG",
        Provider: defaultProvider,
    }

    // basic  config
    cfg := config.Config{
        Port:               defaultPort,
    }

    go web.StartRouter(ctx, logger, r, cfg)
    waitForProvider(t, defaultWaitForProviderDuration)

    logger.Info(ctx, log.WithMessage("ladoing states"))
    // load all states from states folder
    states, err := loadStates("states", storage, customers, logger)
    require.NoError(t, err)
    logger.Info(ctx, log.WithMessage("states loaded"))
    defer func() {
        if err := os.Remove(filepath.Join(statesPath, tempStatePath)); err != nil {
            logger.Error(ctx, log.WithError(err), log.WithMessage("remove temp state file"))
        }
    }()

    var publish bool
    if publishEnv := os.Getenv(pactPublishVerificationEnv); publishEnv != "" {
        publish, err = strconv.ParseBool(publishEnv)
        require.NoError(t, err)
    }

    version := os.Getenv(providerVersionEnv)
    if version == "" {
        version = config.AppVersion
    }

    logger.Info(ctx, log.WithMessage("start provider verification"))
    // Verify the Provider with local Pact Files
    _, err = pact.VerifyProvider(t, types.VerifyRequest{
        ProviderBaseURL:            fmt.Sprintf("http://localhost:%d", defaultPort),
        BrokerURL:                  pactURL,
        BrokerUsername:             pactUsername,
        BrokerPassword:             pactPassword,
        PublishVerificationResults: publish,
        CustomProviderHeaders:      []string{"X-Request-Id: 32758736-cfd4-4874-9110-975947c99bb7"},
        StateHandlers:              states,
        ProviderVersion:            version,
        EnablePending:false,
    })
    logger.Info(ctx, log.WithMessage("pacts verification finished"))
    require.NoError(t, err)
}

func loadState(stateName string, storage StoreWithReloader, customers customer.Customers, logger log.Logger) error {
    logger.Info(context.Background(), log.WithMessage("load state: %v", stateName))

    if err := copyState(stateName, logger); err != nil {
        return fmt.Errorf("prepare temporary state: %w", err)
    }

    if err := storage.Reload("states", afero.NewOsFs(), file.WithLedgerFilename(tempStatePath)); err != nil {
        return err
    }
    if _, err := customers.Reload(1, storage); err != nil {
        return err
    }
    return nil
}

func loadStates(path string, storage StoreWithReloader, customers customer.Customers, logger log.Logger) (types.StateHandlers, error) {
    handlers := make(types.StateHandlers)
    states, err := fileutil.ReadDir(path)
    if err != nil {
        return types.StateHandlers{}, err
    }
    for _, state := range states {
        func(state string) {
            handlers[state] = func() error {
                return loadState(state, storage, customers, logger)
            }
        }(state)
    }
    return handlers, nil
}

func waitForProvider(t *testing.T, ttl time.Duration) {
    ttlReached := make(chan struct{})
    go func() {
        <-time.After(ttl)
        ttlReached <- struct{}{}
    }()

    for {
        select {
        case <-ttlReached:
            t.Error("provider did not start in given time")
            t.Fatal()
            return
        case <-time.After(time.Millisecond * 500):
            t.Log("checking if router is running")
            req, err := http.NewRequest("GET", "http://localhost:8085/v1/version", nil)
            require.NoError(t, err)
            req.Header.Add("X-Request-Id", "aa3fe223-9c7e-4439-822d-cf9be7b21771")
            client := &http.Client{}
            resp, err := client.Do(req)
            if err != nil {
                t.Log("router not yet running")
            }
            if err == nil && resp.StatusCode == http.StatusOK {
                t.Log("router started")
                return
            }
        }
    }
}

func copyState(stateName string, logger log.Logger) error {
    src := filepath.Join(statesPath, stateName)
    dst := filepath.Join(statesPath, tempStatePath)

    sourceFileStat, err := os.Stat(src)
    if err != nil {
        return err
    }

    if !sourceFileStat.Mode().IsRegular() {
        return fmt.Errorf("%s is not a regular file", src)
    }

    source, err := os.Open(src)
    if err != nil {
        return err
    }
    defer func() {
        if err := source.Close(); err != nil {
            logger.Error(context.Background(), log.WithError(err), log.WithMessage("copyState: close source file"))
        }
    }()

    destination, err := os.Create(dst)
    if err != nil {
        return err
    }
    defer func() {
        if err := destination.Close(); err != nil {
            logger.Error(context.Background(), log.WithError(err), log.WithMessage("copyState: close destination file"))
        }
    }()

    _, err = io.Copy(destination, source)
    return err
}

I removed whole router and DI setup. States are files that represent DB states that are loaded whenever given consumer pact requires that state (this is state-heavy app).

This code will obviously not work. It's just to help you debug the issue.

Jarema commented 4 years ago

@mefellows is there any chance for update on this topic?

mefellows commented 4 years ago

Hi @Jarema, apologies I hadn't had a chance until today. OK, so I have been able to reproduce so far. Here is what I've done:

Need to dig into why this is of course, but at least I can repro it!

Jarema commented 4 years ago

@mefellows thanks for the update! Thats actually very good info. I was worried about reproducing, as I was not able to deliver specific scenario myself. I'm looking forward into updates! Seems that it it about quantity, rather than specific logic in contracts.

Jarema commented 4 years ago

@mefellows did you find some time to investigate the issue?

Jarema commented 4 years ago

@mefellows hey, is there any chance for follow up? Our org ci/cd flow is heavily degraded by this bug.

mefellows commented 4 years ago

Sorry Tomasz I haven't been able to fix just yet. I'll have some time later in the week.

If you'd like to chat at slack.pact.io we might be able to find a workaround for you in the meantime.

On Mon, May 11, 2020, 9:09 PM Tomasz notifications@github.com wrote:

@mefellows https://github.com/mefellows hey, is there any chance for follow up? Our org ci/cd flow is heavily degraded by this bug.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-go/issues/128#issuecomment-626636653, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANFDFIKT4UN7UEN2X2GYDRQ7MG5ANCNFSM4MMMVVCA .

Jarema commented 4 years ago

Thanks for update. I'll join the chat to look for workaround.

Jarema commented 3 years ago

@mefellows unfortunately, today bug appeared again.

There were few changes since our last conversation: pact version: 1.88.14 number of pacts with our provider increased significantly