On my consumer tests I have used some random value...
# pact-go
n
On my consumer tests I have used some random values in certain matcher examples (e.g.
time.Now()
). This means that the deduplication mechanism (https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors#deduplication) will not be able effectively deduplicate the contracts, correct ?
y
Correct, if you try and upload the contract with the same commit sha you should be prevented if there is differing data in your pact file. You can use a date matcher (if there is one in go, or reg) and use a generator to provide a fixed value if that is possible for your test
n
Thanks 👍 I am very aware that you can't upload a contract with the same commit sha if there are differences in the contract. My concern is that when you do the provider verification, the deduplication mechanism uses the full contract content as the basis for deduplication, which means that if the example data in the contract is different between the main branch and the feature branch (even though the rules are the same) the provider test will run twice -- assuming your consumer version selectors pick up the 2 contracts.
It seems that having the deduplication mechanism exclude the examples would be sensible.
m
yes, it would be ideal. Worth raising a feature at pact.canny.io if not already there. I think this was raised recently somewhere in slack also
n
Thanks Matt will do