ITV / scala-pact

A Scala implementation of CDC using the Pact standard
Other
107 stars 54 forks source link

Fixed ScalaPactMatchingRuleArrayMinLength writing issue #109

Closed Paulymorph closed 5 years ago

Paulymorph commented 5 years ago
davesmith00000 commented 5 years ago

This looks fine @Paulymorph, thanks for doing the change! :-) Can I ask if you ran the full local build script? You can run it from the command line by doing: bash scripts/local-build-test.sh Sometimes that process can fail for reasons not your fault, so alternatively, you could just run the pact specification tests with sbt pactSpec/test. If you did either of those and they passed then I'm happy to merge this in without any changes. Thanks again!

Paulymorph commented 5 years ago

Well I have done it. The local-build-test failed. The output was like that:

[info] BodyMatchersSpec:
[info] Matching bodies
[info] - should do trivial equality testing
[info] - should handle no body and additional body matching
Attempting to use local pact files at: '/var/folders/qc/jrwbtmpx7dgcb7399kl5gzjr0000gn/T/tmp_pact_743933209194794959.json'
Verifying against 'localhost' on port '64160' with a timeout of 5 second(s).
Results for pact between One of my consumers and Me
 - [  OK  ] Simple example
 - [  OK  ] A strict example
[scala-pact] Run completed in: 296 ms
[scala-pact] Total number of test run: 2
[scala-pact] Tests: succeeded 2, failed 0
[scala-pact] All Pact verify tests passed.
Attempting to use local pact files at: '/var/folders/qc/jrwbtmpx7dgcb7399kl5gzjr0000gn/T/tmp_pact_1396993576185976107.json'
Verifying against 'localhost' on port '64160' with a timeout of 2 second(s).
Results for pact between One of my consumers and Me
 - [  OK  ] Simple example
 - [  OK  ] A strict example
[scala-pact] Run completed in: 20 ms
[scala-pact] Total number of test run: 2
[scala-pact] Tests: succeeded 2, failed 0
[scala-pact] All Pact verify tests passed.
Attempting to use local pact files at: '/var/folders/qc/jrwbtmpx7dgcb7399kl5gzjr0000gn/T/tmp_pact_1842279644459474003.json'
Verifying against 'localhost' on port '64160' with a timeout of 2 second(s).
Results for pact between One of my consumers and Me
 - [  OK  ] Simple example
 - [FAILED] A strict example
Failed to match response
 ...original
Response          [200]
  headers:        [Transfer-Encoding=chunked,\n                   "Server=Jetty(6.1.26)]
  matching rules: []
  body:
["blue", "red"]

 ...closest match was...
Response          [200]
  headers:        []
  matching rules: []
  body:
["red","blue"]

 ...Differences
Node at: [0]
  Value 'red' did not match 'blue'

> Rules:
Rules:
 - 

Node at: [1]
  Value 'blue' did not match 'red'

> Rules:
Rules:
 - 

The pactSpec/test was OK, but

[info] RequestV1_1Spec:
JSON was not an object or an array
JSON was not an object or an array
[info] ResponseV2Spec:

was also in the output. Is that fine?

davesmith00000 commented 5 years ago
[info] RequestV1_1Spec:
JSON was not an object or an array
JSON was not an object or an array
[info] ResponseV2Spec:

That bit is fine, it's testing a failure... so the failure ...is a pass! If you see what I mean. Just looking at the other bit.

davesmith00000 commented 5 years ago

I think the other one is fine too.

Can you run: sbt testsWithDeps/testOnly *ExampleVerification

I believe you'll get the same error, but at the bottom it will say [info] All tests passed.. Is that right?

When building a test framework, one has to test that tests can fail, and this can lead to misleading output. I think this is just that...

Paulymorph commented 5 years ago

Oh, I see. Yes, everything was the way you said.

[info] ExampleVerification:
[info] Verification of pacts using provider tests
[info] - should be able to verify a simple contract
[info] - should verify a permissive pact
[info] - should fail to verify a pact, strictly verified, that does not conform to the Pact spec.
[info] Run completed in 4 seconds, 850 milliseconds.
[info] Total number of tests run: 3
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 3, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
Paulymorph commented 5 years ago

Sorry, seems like I have accidentally closed the request-_-