Skip to content

Commit 9422a3b

Browse files
committed
updating provider name + segregating pact test from default test package
1 parent 1d26d18 commit 9422a3b

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

.github/workflows/publish-pact-verification.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ jobs:
3939
- name: Make provider script executable
4040
run: chmod +x publish-pacts.sh
4141

42-
- name: Run provider publish script
42+
- name: Run Pact verification Test and publish verification report
4343
run: ./publish-pacts.sh

build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ sourceSets {
5454
}
5555
resources.srcDir file('src/integrationTest/resources')
5656
}
57+
pactVerificationTest {
58+
java {
59+
compileClasspath += sourceSets.main.output
60+
runtimeClasspath += sourceSets.main.output
61+
}
62+
resources.srcDir file('src/pactVerificationTest/resources')
63+
}
5764
}
5865

5966
configurations {
@@ -63,6 +70,9 @@ configurations {
6370
integrationTestImplementation.extendsFrom testImplementation
6471
integrationTestRuntimeOnly.extendsFrom runtimeOnly
6572

73+
pactVerificationTestImplementation.extendsFrom testImplementation
74+
pactVerificationTestRuntimeOnly.extendsFrom runtimeOnly
75+
6676
// Ensure testRuntimeClasspath can be resolved for agent injection
6777
testRuntimeClasspath {
6878
canBeResolved = true
@@ -284,15 +294,24 @@ dependencies {
284294
}
285295

286296
tasks.register('pactVerificationTest', Test) {
297+
description = "Runs Pact provider verification tests"
298+
group = "Verification"
299+
testClassesDirs = sourceSets.pactVerificationTest.output.classesDirs
300+
classpath = sourceSets.pactVerificationTest.runtimeClasspath
287301
useJUnitPlatform {
288302
includeTags 'pact'
289303
}
304+
failFast = true
290305
systemProperty 'pact.broker.url', System.getenv('PACT_BROKER_URL')
291306
systemProperty 'pact.broker.token', System.getenv('PACT_BROKER_TOKEN')
292307
systemProperty 'pact.provider.version', System.getenv('GIT_COMMIT') ?: 'dev'
293308
systemProperty 'pact.provider.branch', System.getenv('GIT_BRANCH')
294309
systemProperty 'pact.verifier.publishResults', System.getenv('PACT_VERIFIER_PUBLISH_RESULTS')
295310
systemProperty 'pact.broker.host', System.getenv('PACT_BROKER_HOST')
296311
systemProperty 'pact.env', System.getenv('PACT_ENV')
312+
reports {
313+
junitXml.required.set(true)
314+
html.required.set(true)
315+
}
297316
}
298317
}

publish-pacts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ gradle pactVerificationTest \
2828

2929
# Tag provider in the broker
3030
pact-broker create-version-tag \
31-
--pacticipant "VPCourtScheduleProvider" \
31+
--pacticipant "CPCourtScheduleProvider" \
3232
--version "$GIT_COMMIT" \
3333
--tag "$PACT_ENV" \
3434
--broker-base-url "$PACT_BROKER_URL" \
@@ -37,7 +37,7 @@ pact-broker create-version-tag \
3737
# Can-I-Deploy check
3838
echo "Running can-i-deploy check for provider compatibility..."
3939
pact-broker can-i-deploy \
40-
--pacticipant "VPCourtScheduleProvider" \
40+
--pacticipant "CPCourtScheduleProvider" \
4141
--version "$GIT_COMMIT" \
4242
--to-environment "$PACT_ENV" \
4343
--broker-base-url "$PACT_BROKER_URL" \

src/test/java/uk/gov/hmcts/cp/pact/provider/CourtScheduleProviderPactTest.java renamed to src/pactVerificationTest/java/pact.provider/CourtScheduleProviderPactTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
2929
@ExtendWith({SpringExtension.class, PactVerificationInvocationContextProvider.class})
30-
@Provider("VPCourtScheduleProvider")
30+
@Provider("CPCourtScheduleProvider")
3131
@PactBroker(
3232
scheme = "https",
3333
host = "${pact.broker.host}",

0 commit comments

Comments
 (0)