Skip to content

Commit

Permalink
Add note about pact tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed May 13, 2024
1 parent dbf38b2 commit 123aec7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/manual/pact-testing.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,14 @@ different applications.

When an application calls an API directly, not via GDS API Adapters, this application will be the consumer. For example, Publishing API
is the consumer in the pact tests between it and Content Store, since it makes [direct calls to Content store](https://github.com/alphagov/publishing-api/blob/main/app/adapters/content_store.rb).

## How GDS API Adapters retrieves tests from the Providers

Each provider defines some details of its tests in the `.github/workflows/pact-verify.yml` file. This workflow is used by both
the provider and the consumer (gds-api-adapters), and behaves differently based on the value of the pact_artifact input. If
the pact_artifact variable is missing (run from the provider), the artifact is retrieved from Github. If the pact_artifact variable
is present (run from the consumer), the artifact will be retrieved from the pact broker - in which case the value of the
pact_artifact_file_to_verify input is important. This can be a source of confusion - we're retrieving the artifact from two
different places, and using autogenerated names in one case and explicitly set names in the other case. You should be careful
that the names in the pact_helper.rb files in both the provider and consumer match, and that the value of pact_artifact_file_to_verify
is "gds_api_adapters-<provider_id>.json", where the provider_id is the name from the pact_helper file in snake case.

0 comments on commit 123aec7

Please sign in to comment.