pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.09k stars 480 forks source link

@IgnoreNoPactsToVerify passes verification tests when a connection to the pact-broker can't be established #1322

Closed jarmy closed 3 years ago

jarmy commented 3 years ago

If running a Pact verification SpringBootTest with @IgnoreNoPactsToVerify and there's no SSL/TLS certificates installed allowing a connection to the pact-broker, the test will pass with No pacts found to verify. After enabling debugging on the test side, I was able to find this event (full log pact_SSLHandshakeException.log):

09:53:46.187 [DEBUG] [TestEventLogger]     2021-03-10T09:53:46.154-0800 [Test worker] WARN  a.c.d.pact.core.pactbroker.HalClient - Could not fetch the root HAL document
09:53:46.187 [DEBUG] [TestEventLogger]     javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I'd like to think that if no connection can be made to the broker, the test would fail.

Here's the pact libraries we're using:

    testImplementation "au.com.dius.pact.provider:junit5:4.1.7"
    testImplementation "au.com.dius.pact.provider:junit5spring:4.1.7"
uglyog commented 3 years ago

@jarmy could you try with the latest versions (4.1.17)? The error handling was changed.

jarmy commented 3 years ago

@uglyog After upgrading, the test fails with au.com.dius.pact.core.pactbroker.InvalidNavigationRequest: Failed to fetch the root HAL document. This is resolved.