hi pact-go team, apologies for the long question. ...
# pact-go
j
hi pact-go team, apologies for the long question. thanks in advance for your help! πŸ™ i've upgraded my
pact-go
to
v2.0.0-beta.14
and updated my consumer test to use Pact V4 such as replacing
NewV3Pact()
with
NewV4Pact()
. i understand that Pact V4 adds a `key` field to an interaction and its value seems to be some hash when i looked at its value in the pact generated when i ran my test. i'm guessing the hash is calculated using the
description
,
provider_states
,
request
,
response
and
pending
fields in https://github.com/pact-foundation/pact-reference/blob/9d30a4411dfab9f0993070ef34d2ea8bf8d28a6d/rust/pact_models/src/v4/synch_http.rs#L397 i ran my consumer test several times without changing the interactions. when i inspected the value of the
key
field in the pact file generated, i was surprised to see that its value changes between runs. should its value stay the same instead since the pact didn't change? the pact broker thinks my consumer published a new pact, but it shouldn't be the case since i just generated again the same pact and published it without changing anything. i've attached a snippet of my simplified setup of the mock provider with interactions in this thread for reference.
snippet.go
when i tried removing the 3rd argument (request builder func) from
WithRequestPathMatcher()
, the
key
field's value in the pact generated stayed the same between runs though. but this is not an option for me since i need that 3rd argument πŸ˜…
m
Haha well it's expected to be used! Are you using any dynamic values, E.g. in the bearer token?
If the values change I could see why that would impact the hash
j
hey Matt! thanks for the reply. i'm not using any dynamic values in any of the matchers in the request builder of the interaction. for instance, the bearer token is set to just a constant string as in the snippet above πŸ˜… when i compared the generated pact json files between test runs, it's only the
key
value that's different. everything else is the same 😭
πŸ€” 1
m
If you could please raise an issue that reproduces the problem we can look into it
j
i'll do this Matt. thanks! πŸ™
πŸ™Œ 1
created https://github.com/pact-foundation/pact-go/issues/230. please let me know if you have any concerns about it. thanks! again! πŸ™
πŸ™ 1
m
that’s great, thank you!