-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pacts for verification): do not require environment variable fea…
…ture toggle to enable feature Removes support for the GET method on the pacts for verification resource.
- Loading branch information
Showing
7 changed files
with
97 additions
and
203 deletions.
There are no files selected for viewing
37 changes: 0 additions & 37 deletions
37
lib/pact_broker/api/contracts/verifiable_pacts_query_schema.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
lib/pact_broker/doc/views/provider-pacts-for-verification.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Provider pacts for verification | ||
|
||
Path: `/pacts/provider/{provider}/for-verification` | ||
|
||
Allowed methods: `POST` | ||
|
||
Content type: `application/hal+json` | ||
|
||
Returns a deduplicated list of pacts to be verified by the specified provider. | ||
|
||
### Body | ||
|
||
Example: This data structure represents the way a user might specify "I want to verify the latest 'master' pact, all 'prod' pacts, and when I publish the verification results, I'm going to tag the provider version with 'master'" | ||
|
||
|
||
```json | ||
{ | ||
"consumerVersionSelectors": [ | ||
{ | ||
"tag": "master", | ||
"latest": true | ||
},{ | ||
"tag": "prod" | ||
} | ||
], | ||
"providerVersionTags": ["master"], | ||
"includePendingStatus": true, | ||
"includeWipPactsSince": "2020-01-01" | ||
} | ||
``` | ||
|
||
`consumerVersionSelectors.tag`: the tag name(s) of the consumer versions to get the pacts for. | ||
|
||
`consumerVersionSelectors.fallbackTag`: the name of the tag to fallback to if the specified `tag` does not exist. This is useful when the consumer and provider use matching branch names to coordinate the development of new features. | ||
|
||
`consumerVersionSelectors.latest`: true. If the latest flag is omitted, *all* the pacts with the specified tag will be returned. (This might seem a bit weird, but it's done this way to match the syntax used for the matrix query params. See https://docs.pact.io/selectors) | ||
|
||
`consumerVersionSelectors.consumer`: allows a selector to only be applied to a certain consumer. This is used when there is an API that has multiple consumers, one of which is a deployed service, and one of which is a mobile consumer. The deployed service only needs the latest production pact verified, where as the mobile consumer may want all the production pacts verified. | ||
|
||
`providerVersionTags`: the tag name(s) for the provider application version that will be published with the verification results. This is used by the Broker to determine whether or not a particular pact is in pending state or not. This parameter can be specified multiple times. | ||
|
||
`includePendingStatus`: true|false (default false). When true, a pending boolean will be added to the verificationProperties in the response, and an extra message will appear in the notices array to indicate why this pact is/is not in pending state. This will allow your code to handle the response based on only what is present in the response, and not have to do ifs based on the user's options together with the response. As requested in the "pacts for verification" issue, please print out these messages in the tests if possible. If not possible, perhaps create a separate task which will list the pact URLs and messages for debugging purposes. | ||
|
||
`includeWipPactsSince`: Date string. The date from which to include the "work in progress" pacts. See https://docs.pact.io/wip for more information on work in progress pacts. | ||
|
||
### Response body | ||
|
||
`pending` flag and the "pending reason" notice will only be included if `includePendingStatus` is set to true. | ||
|
||
```json | ||
{ | ||
"_embedded": { | ||
"pacts": [ | ||
{ | ||
"verificationProperties": { | ||
"notices": [ | ||
{ | ||
"text": "This pact is being verified because it is the pact for the latest version of Foo tagged with 'dev'", | ||
"when": "before_verification" | ||
} | ||
], | ||
"pending": false | ||
}, | ||
"_links": { | ||
"self": { | ||
"href": "http://localhost:9292/pacts/provider/Bar/consumer/Foo/pact-version/0e3369199f4008231946e0245474537443ccda2a", | ||
"name": "Pact between Foo (v1.0.0) and Bar" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"_links": { | ||
"self": { | ||
"href": "http://localhost:9292/pacts/provider/Bar/for-verification", | ||
"title": "Pacts to be verified" | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 0 additions & 97 deletions
97
spec/lib/pact_broker/api/contracts/verifiable_pacts_query_schema_spec.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters