Im a little lost with the `publish` command and th...
# pact-broker
b
Im a little lost with the
publish
command and the matrix that is maintained in the pact-broker. From the docs I've read, provided the pacts have already been tested on the provider and have not been changed by the Consumer then the matrix should show that when I publish new Consumer results they have already been verified on the Producer side. However, what im seeing is that whenever a new Consumer verification result is published to the pact-broker my Matrix shows it has not been verified by the Producer even though there has been no change to the contract itself. Am i missing something? Can someone help explain what im doing wrong here? Thanks
Note: Im using pactflow and my broker
m
My guess is that the contracts are differing slightly. In the HAL browser you can navigate to the pact and do a diff on the previous version to see why they are different
do you use Pact JVM by any chance? If so, and you use matchers without specifying the example, I believe it will generate a random value. If so, this could explain why the pacts differ
b
I tried the distinct-diff api, all it showed was the schema version had changed?
m
can you please show me what you mean?
b
pb:diff-previous-distinct
Copy code
{
       "response": {
         "body": {
-          "schema_version": "4.0"
+          "schema_version": "8111.65"
         }
       }
     },
m
so yes, the contract has changed
b
Is there a way to see what it thinks has changed?
And yes i am using pactJVM
m
I’m confused about what you mean. The above diff clearly shows it has changed.
b
But i dont know what has changed, In my mind as i see it i have made no change
m
My guess is that you are using a matcher for the
schema_version
property in your consumer test. If you can share that part of the test I can give some pointers
b
ohhh wait ive got it now! Sorry i thought
schema_version
was something controlled by pact, but its the
schema_version
in my API facepalm oh dear!
☝️ 1
you are exactly right
Copy code
.stringMatcher("schema_version", "[0-9]+\\.[0-9]+")
m
boom got it!
nice one, so yes, if you just pop a canned number in there (I think the 3rd argument) that should stop it from generating random values
@uglyog I’m wondering if we should mark those methods that don’t take examples as either deprecated on not best practice, as it essentially it works against our guidance of the pre-validation in the broker. Thoughts? cc: @Beth (pactflow.io/Pact Broker/pact-ruby)
👍 1
b
Cheers its working as expected now! thankyou
🙌 1
b
Yes Matt, that would make sense.
👍 2