Noor Hashem
10/24/2022, 7:05 PMMatt (pactflow.io / pact-js / pact-go)
Noor Hashem
10/25/2022, 1:55 AMYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
PactProviderModule.register({
...
publishVerificationResult: true,
enablePending: true,
}) as any as Type<unknown>,
in providerTest-guest-users.pact.test.ts
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Verify:
needs: Test
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
fail-fast: true
env:
pact_broker: example
pact_broker_token: exmaple
PACT_BROKER_PUBLISH_VERIFICATION_RESULTS: true
version: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
GIT_COMMIT: ${{ github.sha }}
application_name: 'platform_payment_service'
steps:
# checking out the provider so that we can run their pact tests on the consumer side
- uses: actions/checkout@v3
with:
repository: 'applyboard/platform_payment_service'
# some steps in the middle that i removed as they are confidential but essentially just setting up the provider test database and authentication etc.
- name: run pact Test and publish results
run: npm run pact:test
the following values are from your consumer build and shouldn't be used by your provider, and in-fact aren't picked up by your provider build which uses these two
const commitHash = execSync('git rev-parse HEAD')
.toString().trim()
const branch_name = execSync('git rev-parse --abbrev-ref HEAD')
.toString().trim()
the type of provider build you are running, should normally be run in the providers pipeline when the provider build changes, it should have
1. consumer version selectors
2. enablePending true
3. includeWIPPacts
it would then pick up your pacts, and not fail the build
There is an additional type of provider verification that can be run, based on a changed pact URL, this URL, is output when your consumer contract is uploaded, and dependant on the event (pact content changed or contract requiring verification published), you could then verify just that Pact.
this provider verification build would only need the the pact url, over the above options.