Closed jmalvinez-wes closed 12 months ago
@uglyog any ideas?
The code doesn't have any dynamic components to it: https://github.com/jmalvinez/pact-v4-using-pact-go/blob/main/consumer_test.go#L20-L27
The key is calculated, if it is not already set. It will be based on the contents, and will be sensitive to the order of things. So either the contents is changing, or the order of something is changing.
Thanks. Looks like I have some tracking down to do!
BTW, the key is designed to be set by the user, and is only calculated if not set. It is to provide a unique identifier within the Pact file. Having different keys is ok, as long as two different interactions don't ever have the same key.
Thanks. I think the primary issue is that it mean the pre-verification in the broker is invalidated because the contents changes. I'm sure we'll track down the source.
I've managed to create a minimal repro in Go: https://github.com/pact-foundation/pact-go/blob/repro/issue-230/internal/native/mock_server_test.go#L139.
The critical thing that seems to result in the problem, are items on the request.
In this case, the headers - if no request headers are set, then this problem doesn't seem to happen. I can also reproduce the problem by expecting a request body. This is not a problem if added to the response headers or body.
As you would expect, the ffi implementation in Go is the same for both of them, the only difference is the interaction part that is passed to the pactffi_with_body
and pactffi_with_header_v2
methods.
The test runs a loop of 10 pact tests, and then diffs the resulting pact files in each iteration. When they keys differ, the diff is printed and you can see that only the name and keys change. The pact files are removed between runs to remove that code path (although this doesn't seem to impact the calculation of the keys).
What's interesting, is that it is inconsistent in that not all repetitions produce the same result (i.e. sometimes the keys are the same), but when they do have different keys, the two resulting key
values always the same across repetitions:
➜ native git:(repro/issue-230) ✗ go test -count=1 -v -run TestHandleBasedHTTPTests <aws:pactflow-prod-admin>
# github.com/pact-foundation/pact-go/v2/internal/native.test
ld: warning: -no_pie is deprecated when targeting new OS versions
ld: warning: non-standard -pagezero_size is deprecated when targeting macOS 13.0 or later
=== RUN TestHandleBasedHTTPTests
mock_server_test.go:135: Running attempt 0 ============>
2023-04-11T02:11:28.880736Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"user-agent": ["Go-http-client/1.1"], "host": ["0.0.0.0:63638"], "accept-encoding": ["gzip"], "content-length": ["0"], "content-type": ["application/json"]}), body: Empty )
2023-04-11T02:11:28.880849Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:28.881039Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:28.881808Z INFO ThreadId(02) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:28.885234Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"host": ["0.0.0.0:63640"], "user-agent": ["Go-http-client/1.1"], "accept-encoding": ["gzip"], "content-length": ["0"], "content-type": ["application/json"]}), body: Empty )
2023-04-11T02:11:28.885266Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:28.885321Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:28.885481Z INFO ThreadId(03) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:135: Running attempt 1 ============>
2023-04-11T02:11:28.914369Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"host": ["0.0.0.0:63643"], "content-length": ["0"], "user-agent": ["Go-http-client/1.1"], "accept-encoding": ["gzip"], "content-type": ["application/json"]}), body: Empty )
2023-04-11T02:11:28.914427Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:28.914665Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:28.914993Z INFO ThreadId(04) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:28.917618Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"accept-encoding": ["gzip"], "content-length": ["0"], "host": ["0.0.0.0:63645"], "user-agent": ["Go-http-client/1.1"], "content-type": ["application/json"]}), body: Empty )
2023-04-11T02:11:28.917701Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:28.917784Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:28.917923Z INFO ThreadId(02) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:178: Interaction keys changed:
mock_server_test.go:179: 3c3
< "name": "test-http-consumer0"
---
> "name": "test-http-consumer1"
8c8
< "key": "e7526df2762454b2",
---
> "key": "83026150f0234ed1",
mock_server_test.go:135: Running attempt 2 ============>
2023-04-11T02:11:28.942973Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"], "host": ["0.0.0.0:63648"], "user-agent": ["Go-http-client/1.1"], "content-length": ["0"], "accept-encoding": ["gzip"]}), body: Empty )
2023-04-11T02:11:28.943028Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:28.943103Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:28.943299Z INFO ThreadId(04) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:28.945917Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"], "host": ["0.0.0.0:63650"], "user-agent": ["Go-http-client/1.1"], "accept-encoding": ["gzip"], "content-length": ["0"]}), body: Empty )
2023-04-11T02:11:28.945959Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:28.946068Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:28.946229Z INFO ThreadId(03) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:178: Interaction keys changed:
mock_server_test.go:179: 3c3
< "name": "test-http-consumer0"
---
> "name": "test-http-consumer1"
8c8
< "key": "e7526df2762454b2",
---
> "key": "83026150f0234ed1",
mock_server_test.go:135: Running attempt 3 ============>
2023-04-11T02:11:28.971699Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"user-agent": ["Go-http-client/1.1"], "content-length": ["0"], "host": ["0.0.0.0:63652"], "accept-encoding": ["gzip"], "content-type": ["application/json"]}), body: Empty )
2023-04-11T02:11:28.971762Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:28.971856Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:28.972038Z INFO ThreadId(02) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:28.974237Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-length": ["0"], "host": ["0.0.0.0:63654"], "accept-encoding": ["gzip"], "user-agent": ["Go-http-client/1.1"], "content-type": ["application/json"]}), body: Empty )
2023-04-11T02:11:28.974276Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:28.974443Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:28.974585Z INFO ThreadId(04) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:135: Running attempt 4 ============>
2023-04-11T02:11:29.001885Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-length": ["0"], "accept-encoding": ["gzip"], "host": ["0.0.0.0:63656"], "user-agent": ["Go-http-client/1.1"], "content-type": ["application/json"]}), body: Empty )
2023-04-11T02:11:29.001981Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.002119Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.002355Z INFO ThreadId(05) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:29.004566Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"], "user-agent": ["Go-http-client/1.1"], "accept-encoding": ["gzip"], "host": ["0.0.0.0:63658"], "content-length": ["0"]}), body: Empty )
2023-04-11T02:11:29.004601Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.004661Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.004765Z INFO ThreadId(04) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:178: Interaction keys changed:
mock_server_test.go:179: 3c3
< "name": "test-http-consumer0"
---
> "name": "test-http-consumer1"
8c8
< "key": "e7526df2762454b2",
---
> "key": "83026150f0234ed1",
mock_server_test.go:135: Running attempt 5 ============>
2023-04-11T02:11:29.026737Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"host": ["0.0.0.0:63660"], "user-agent": ["Go-http-client/1.1"], "accept-encoding": ["gzip"], "content-type": ["application/json"], "content-length": ["0"]}), body: Empty )
2023-04-11T02:11:29.026794Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.026882Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.027086Z INFO ThreadId(02) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:29.029636Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"host": ["0.0.0.0:63662"], "user-agent": ["Go-http-client/1.1"], "content-length": ["0"], "accept-encoding": ["gzip"], "content-type": ["application/json"]}), body: Empty )
2023-04-11T02:11:29.029669Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.029727Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.029909Z INFO ThreadId(06) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:178: Interaction keys changed:
mock_server_test.go:179: 3c3
< "name": "test-http-consumer0"
---
> "name": "test-http-consumer1"
8c8
< "key": "83026150f0234ed1",
---
> "key": "e7526df2762454b2",
mock_server_test.go:135: Running attempt 6 ============>
2023-04-11T02:11:29.053010Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"accept-encoding": ["gzip"], "host": ["0.0.0.0:63664"], "content-type": ["application/json"], "user-agent": ["Go-http-client/1.1"], "content-length": ["0"]}), body: Empty )
2023-04-11T02:11:29.053062Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.053149Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.053341Z INFO ThreadId(04) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:29.056167Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"accept-encoding": ["gzip"], "content-length": ["0"], "content-type": ["application/json"], "host": ["0.0.0.0:63666"], "user-agent": ["Go-http-client/1.1"]}), body: Empty )
2023-04-11T02:11:29.056188Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.056228Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.056338Z INFO ThreadId(03) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:178: Interaction keys changed:
mock_server_test.go:179: 3c3
< "name": "test-http-consumer0"
---
> "name": "test-http-consumer1"
8c8
< "key": "e7526df2762454b2",
---
> "key": "83026150f0234ed1",
mock_server_test.go:135: Running attempt 7 ============>
2023-04-11T02:11:29.079507Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"host": ["0.0.0.0:63668"], "content-type": ["application/json"], "user-agent": ["Go-http-client/1.1"], "accept-encoding": ["gzip"], "content-length": ["0"]}), body: Empty )
2023-04-11T02:11:29.079560Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.079656Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.079820Z INFO ThreadId(03) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:29.081891Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"user-agent": ["Go-http-client/1.1"], "content-type": ["application/json"], "accept-encoding": ["gzip"], "host": ["0.0.0.0:63670"], "content-length": ["0"]}), body: Empty )
2023-04-11T02:11:29.081923Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.081973Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.082135Z INFO ThreadId(06) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:135: Running attempt 8 ============>
2023-04-11T02:11:29.104531Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"host": ["0.0.0.0:63672"], "content-type": ["application/json"], "user-agent": ["Go-http-client/1.1"], "accept-encoding": ["gzip"], "content-length": ["0"]}), body: Empty )
2023-04-11T02:11:29.104583Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.104659Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.104837Z INFO ThreadId(02) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:29.110184Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"user-agent": ["Go-http-client/1.1"], "host": ["0.0.0.0:63674"], "content-type": ["application/json"], "accept-encoding": ["gzip"], "content-length": ["0"]}), body: Empty )
2023-04-11T02:11:29.110235Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.110319Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.110472Z INFO ThreadId(03) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:135: Running attempt 9 ============>
2023-04-11T02:11:29.130924Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"accept-encoding": ["gzip"], "content-type": ["application/json"], "host": ["0.0.0.0:63676"], "content-length": ["0"], "user-agent": ["Go-http-client/1.1"]}), body: Empty )
2023-04-11T02:11:29.130980Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.131126Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.131376Z INFO ThreadId(06) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer0-test-http-provider.json'
2023-04-11T02:11:29.133790Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request HTTP Request ( method: POST, path: /products, query: None, headers: Some({"host": ["0.0.0.0:63678"], "content-length": ["0"], "user-agent": ["Go-http-client/1.1"], "content-type": ["application/json"], "accept-encoding": ["gzip"]}), body: Empty )
2023-04-11T02:11:29.133830Z INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: POST, path: /products, query: None, headers: Some({"content-type": ["application/json"]}), body: Missing )
2023-04-11T02:11:29.133888Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(13 bytes, application/json) )
2023-04-11T02:11:29.134008Z INFO ThreadId(06) pact_mock_server::mock_server: Writing pact out to '/tmp/test-http-consumer1-test-http-provider.json'
mock_server_test.go:178: Interaction keys changed:
mock_server_test.go:179: 3c3
< "name": "test-http-consumer0"
---
> "name": "test-http-consumer1"
8c8
< "key": "83026150f0234ed1",
---
> "key": "e7526df2762454b2",
--- PASS: TestHandleBasedHTTPTests (0.28s)
PASS
ok github.com/pact-foundation/pact-go/v2/internal/native 1.674s
👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1035). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.
See our documentation for more information.
I've just pushed out a minor bump to the FFI version (0.4.4) which contains a fix for the key generation. The ultimate fix is to remove the key generation as commented in the upstream issue, but it might help you for now depending on the use case.
am seeing a missing key error when trying to run the gRPC sample in the pact-go repository with latest code ( 0.4.5 FFI):
Verifying a pact between grpcconsumer and grpcprovider
Route guide - GetFeature (1ms loading, 28ms verification)
Given feature 'Big Tree' exists
Failures:
1) Verifying a pact between grpcconsumer and grpcprovider Given feature 'Big Tree' exists - Route guide - GetFeature - Failed to prepare interaction for verification - Failed to prepate the request: Did not find interaction with key '5827c9fe506611a0' in the Pact
Thanks, I recommend ffi 0.4.5 until the upstream issue is resolved
On Thu, Jun 1, 2023, 05:11 jasonltaylor @.***> wrote:
am seeing a missing key error when trying to run the gRPC sample in the pact-go repository with latest code ( 0.4.5 FFI):
Verifying a pact between grpcconsumer and grpcprovider
Route guide - GetFeature (1ms loading, 28ms verification) Given feature 'Big Tree' exists
Failures:
1) Verifying a pact between grpcconsumer and grpcprovider Given feature 'Big Tree' exists - Route guide - GetFeature - Failed to prepare interaction for verification - Failed to prepate the request: Did not find interaction with key '5827c9fe506611a0' in the Pact
— Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-go/issues/230#issuecomment-1570784604, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANFDG5GI3MAW5NYKOMCQDXI6JW3ANCNFSM54SHLGZQ . You are receiving this because you commented.Message ID: @.***>
This should be fixed in v2.0.0-beta.21
now.
Software versions
Expected behaviour
Running the same test multiple times should generate the same Pact file each time regardless of whether a request/response builder is used for an interaction.
Actual behaviour
Value of the
key
field in the generated Pact file differs between runs of the same test when a request/response builder is used for an interaction.Steps to reproduce
The repository contains a simple consumer test that uses
consumer.NewV4Pact
andconsumer.V4RequestBuilder
.git clone https://github.com/jmalvinez/pact-v4-using-pact-go
cd pact-v4-using-pact-go
go test
pacts
directory and take note of thekey
field's value.key
field's value is eitherd69ea55f8aa82b8c
or7a701cd93aefdc
between runs of the same test. The said field's value seems to be the hash of an interaction's contents, but why does the hash change when the interaction has remained the same?