You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the implementation guide for Pacts Maven plugin it is mentioned, that you can use failIfNoPactsFound to ignore if there are no pacts defined for a given provider. But when the provider is unknown to the broker, the broker will not return an empty list but a 404:
HTTP/1.1 404 Not Found
Content-Type: application/hal+json;charset=utf-8
{"error":"No provider with name 'MyEventProvider' found"}
This causes the plugin to throw an exception: Execution verify-pact-contracts of goal au.com.dius.pact.provider:maven:4.2.8:verify failed: Call to fetch pacts from Pact Broker failed with an exception: No HAL document found at path 'http://localhost:9292/pacts/provider/MyEventProvider/for-verification'.
I suspect that the PactProviderMojo.loadPactsFromPactBroker() cannot handle a 404 response by the broker (see here).
I think the same change as for the @IgnoreNoPactsToVerify needs to be done (see #1324).
My setup
<plugin>
<groupId>au.com.dius.pact.provider</groupId>
<artifactId>maven</artifactId>
<version>4.2.8</version>
<configuration>
<pactBrokerUrl>http://localhost:9292</pactBrokerUrl>
<projectVersion>0.1-SNAPSHOT</projectVersion>
<trimSnapshot>true</trimSnapshot> <!-- the pact broker has issues parsing SNAPSHOT versions -->
<skipPactPublish>false</skipPactPublish>
<failIfNoPactsFound>false</failIfNoPactsFound> <!-- FIXME: set to true, once the initial pacts are available -->
<tags>
<tag>dev</tag>
</tags>
<systemPropertyVariables>
<pact.verifier.publishResults>true</pact.verifier.publishResults>
</systemPropertyVariables>
<serviceProviders>
<serviceProvider>
<name>MyEventProvider</name>
<verificationType>ANNOTATED_METHOD</verificationType>
</serviceProvider>
</serviceProviders>
</configuration>
</plugin>
Misc
For some providers, the broker seems to "know"(?) them and returns a 200 with an empty list, this the plugin can handle:
HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=utf-8
{"_embedded":{"pacts":[]},"_links":{"self":{"href":"http://localhost:9292/pacts/provider/MyOtherEventProvider/for-verification","title":"Pacts to be verified"}}}
Expected behaviour
That the failIfNoPactsFound works like @IgnoreNoPactsToVerify, in that it can also ignore a 404 being returned by the pact broker. Or the pact broker not returning a 404.
The text was updated successfully, but these errors were encountered:
JapuDCret
pushed a commit
to JapuDCret/pact-jvm
that referenced
this issue
Aug 23, 2021
The issue
In the implementation guide for Pacts Maven plugin it is mentioned, that you can use
failIfNoPactsFound
to ignore if there are no pacts defined for a given provider. But when the provider is unknown to the broker, the broker will not return an empty list but a 404:This causes the plugin to throw an exception:
Execution verify-pact-contracts of goal au.com.dius.pact.provider:maven:4.2.8:verify failed: Call to fetch pacts from Pact Broker failed with an exception: No HAL document found at path 'http://localhost:9292/pacts/provider/MyEventProvider/for-verification'
.I suspect that the
PactProviderMojo.loadPactsFromPactBroker()
cannot handle a 404 response by the broker (see here).I think the same change as for the
@IgnoreNoPactsToVerify
needs to be done (see #1324).My setup
Misc
For some providers, the broker seems to "know"(?) them and returns a 200 with an empty list, this the plugin can handle:
Expected behaviour
That the
failIfNoPactsFound
works like@IgnoreNoPactsToVerify
, in that it can also ignore a 404 being returned by the pact broker. Or the pact broker not returning a 404.The text was updated successfully, but these errors were encountered: