Nathan Deamer
09/13/2023, 3:06 PMpact.filter.pacturl property. I can’t see if its working.
Using the junit5 style tests:
@ExtendWith(SpringExtension.class)
@Provider("provider-name-here")
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT})
@PactBroker(url = "${PACT_BROKER_BASE_URL}", authentication = @PactBrokerAuth(token = "${PACT_BROKER_TOKEN}"))
@IgnoreNoPactsToVerify
public class ProviderPactTests {
...
}
And then my CICD pipeline rungs the provider pact tests using gradle plugin
./gradlew test -Ppact.filter.pacturl=url-from-webhook -Ppact.filter.consumers=consumer-name --tests "*Provider*"
I’d expect in the output for it to tell me it has applied the filter, but instead I get:
Verifying a pact between ecom-booking-portal (b21f4285ced5cb513a3bddf579a3d54c2c2c419f) and ecom-booking-portal-service
Notices:
1) The pact at <https://xxx.pactflow.io/pacts/provider/ecom-booking-portal-service/consumer/ecom-booking-portal/pact-version/2aa8bcb012d1c007a5f867f3bed41a68f2688e56> is being verified because the pact content belongs to the consumer versions matching the following criteria:
* consumer version(s) currently deployed to dev (b21f4285ced5cb513a3bddf579a3d54c2c2c419f), ext (b21f4285ced5cb513a3bddf579a3d54c2c2c419f) and production (b21f4285ced5cb513a3bddf579a3d54c2c2c419f)
* latest version of ecom-booking-portal from the main branch 'main' (b21f4285ced5cb513a3bddf579a3d54c2c2c419f)
[from Pact Broker <https://xxx.pactflow.io/pacts/provider/ecom-booking-portal-service/consumer/ecom-booking-portal/pact-version/2aa8bcb012d1c007a5f867f3bed41a68f2688e56/metadata/c1tdW2N2XT0xMjUwMCZzW11bY3ZdPTEyNTAwJnNbXVtjdl09MTI1MDAmc1tdW2N2XT0xMjUwMA>]
Where I can see it is checking the deployed versions and latest main.Nathan Deamer
09/13/2023, 3:36 PM16:35:24.477 [Test worker] DEBUG au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider$Companion - Verifying pacts for provider 'ecom-booking-portal-service' and consumer 'null'
Consumer null from the debug lines looks like it is ignoring the properties:
pact.filter.consumers=ecom-booking-portalNathan Deamer
09/13/2023, 3:59 PM[Test worker] DEBUG au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader$Companion - Loading pacts from pact broker for provider ecom-booking-portal-service and consumer version selectors []Nathan Deamer
09/13/2023, 4:04 PMNathan Deamer
09/13/2023, 4:30 PM@AllowOverridePactUrl to my provider test! 🙈rholshausen
09/14/2023, 6:35 AM./gradlew test -Ppact.filter.pacturl=url-from-webhook -Ppact.filter.consumers=consumer-name --tests "*Provider*" as it sets the property in the Gradle build but not in the testsrholshausen
09/14/2023, 6:42 AMtest {rholshausen
09/14/2023, 6:42 AMtest {
systemPropety 'pact.filter.pacturl', project.property('pact.filter.pacturl')
}Matt (pactflow.io / pact-js / pact-go)
Nathan Deamer
09/14/2023, 7:12 AMtest {
useJUnitPlatform()
systemProperties System.properties
}
And then setting the properties with the -D flagNathan Deamer
09/14/2023, 7:13 AM