Skip to content

Commit

Permalink
Merge compatibility suite commit 'c83dd5d2971131c897cfab511a8c502d0b5…
Browse files Browse the repository at this point in the history
…06961'
  • Loading branch information
rholshausen committed May 25, 2023
2 parents 8563211 + c83dd5d commit 3db9bce
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@consumer
Feature: Basic HTTP consumer
Supports basic HTTP consumer interactions

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@provider
Feature: Basic HTTP provider
Supports verifying a basic HTTP provider

Expand All @@ -16,7 +17,7 @@ Feature: Basic HTTP provider
Then the verification will be successful

Scenario: Verifying multiple Pact files
Given a provider is started that returns the responses from interactions {1, 2}
Given a provider is started that returns the responses from interactions "1, 2"
And a Pact file for interaction {1} is to be verified
And a Pact file for interaction {2} is to be verified
When the verification is run
Expand All @@ -27,18 +28,25 @@ Feature: Basic HTTP provider
And a Pact file for interaction {2} is to be verified
When the verification is run
Then the verification will NOT be successful
And the idiot who created the provider will have a stern talking to

And the verification results will contain a "Response status did not match" error

Scenario: Verifying a simple HTTP request via a Pact broker
Given a provider is started that returns the response from interaction {1}
And a Pact file for interaction {1} is to be verified from a Pact broker
When the verification is run
Then the verification will be successful
And a successful verification result will be published back for the interaction {1}
And a verification result will NOT be published back

Scenario: Verifying a simple HTTP request via a Pact broker with publishing results enabled
Given a provider is started that returns the response from interaction {1}
And a Pact file for interaction {1} is to be verified from a Pact broker
And publishing of verification results is enabled
When the verification is run
Then the verification will be successful
And a successful verification result will be published back for interaction {1}

Scenario: Verifying multiple Pact files via a Pact broker
Given a provider is started that returns the responses from interactions {1, 2}
Given a provider is started that returns the responses from interactions "1, 2"
And a Pact file for interaction {1} is to be verified from a Pact broker
And a Pact file for interaction {2} is to be verified from a Pact broker
When the verification is run
Expand Down
210 changes: 210 additions & 0 deletions compatibility-suite/pact-compatibility-suite/fixtures/pact-broker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
{
"consumer": {
"name": "Pact Compatability Suite Broker Client"
},
"interactions": [
{
"description": "a request for the provider pacts",
"pending": false,
"request": {
"body": {
"content": {
"consumerVersionSelectors": [],
"includePendingStatus": false
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json"
]
},
"method": "POST",
"path": "/pacts/provider/p/for-verification"
},
"response": {
"body": {
"content": {
"_embedded": {
"pacts": [
{
"_links": {
"self": {
"href": "http://localhost:9876/pacts/provider/p/consumer/c_1",
"name": "Pact between c_1 and p"
}
},
"shortDescription": "latest"
}
]
},
"_links": {
"self": {
"href": "http://localhost:9876/pacts/provider/{provider}/for-verification",
"title": "Pacts to be verified"
}
}
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json"
]
},
"matchingRules": {
"body": {
"$._embedded.pacts[*]._links.self.href": {
"combine": "AND",
"matchers": [
{
"match": "regex",
"regex": ".*\\/(pacts\\/provider\\/p\\/consumer\\/c_1)$"
}
]
}
}
},
"generators": {
"body": {
"$._embedded.pacts[*]._links.self.href": {
"type": "MockServerURL",
"example": "http://localhost:9876/pacts/provider/p/consumer/c_1",
"regex": ".*\\/(pacts\\/provider\\/p\\/consumer\\/c_1)$"
}
}
},
"status": 200
},
"transport": "https",
"type": "Synchronous/HTTP"
},
{
"description": "a request to the root",
"pending": false,
"request": {
"method": "GET",
"path": "/"
},
"response": {
"body": {
"content": {
"_links": {
"pb:provider-pacts-for-verification": {
"href": "http://localhost:9876/pacts/provider/{provider}/for-verification",
"templated": true,
"title": "Pact versions to be verified for the specified provider"
}
}
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json"
]
},
"matchingRules": {
"body": {
"$._links.pb:provider-pacts-for-verification.href": {
"combine": "AND",
"matchers": [
{
"match": "regex",
"regex": ".*\\/(\\Qpacts\\E\\/\\Qprovider\\E\\/\\Q{provider}\\E\\/\\Qfor-verification\\E)$"
}
]
}
}
},
"generators": {
"body": {
"$._links.pb:provider-pacts-for-verification.href": {
"type": "MockServerURL",
"example": "http://localhost:9876/pacts/provider/{provider}/for-verification",
"regex": ".*\\/(\\Qpacts\\E\\/\\Qprovider\\E\\/\\Q{provider}\\E\\/\\Qfor-verification\\E)$"
}
}
},
"status": 200
},
"transport": "https",
"type": "Synchronous/HTTP"
},
{
"description": "publish verification results for c_1",
"pending": false,
"request": {
"method": "POST",
"path": "/pacts/provider/p/consumer/c_1/verification-results",
"headers": {
"Content-Type": ["application\/json; charset=UTF-8"]
},
"body": {
"content": {
"providerApplicationVersion": "0.0.0",
"success": true,
"verifiedBy":{
"implementation": "Pact-JVM",
"version": "4.5.7"
}
},
"contentType": "application/json",
"encoded": false
},
"matchingRules": {
"body": {
"$.providerApplicationVersion": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.success": {
"combine": "AND",
"matchers": [
{
"match": "boolean"
}
]
},
"$.verifiedBy.implementation": {
"combine": "AND",
"matchers": [
{
"match": "type"
}
]
},
"$.verifiedBy.version": {
"combine": "AND",
"matchers": [
{
"match": "semver"
}
]
}
}
}
},
"response": {
"status": 201
},
"transport": "https",
"type": "Synchronous/HTTP"
}
],
"metadata": {
"pactSpecification": {
"version": "4.0"
}
},
"provider": {
"name": "Pact Broker"
}
}

0 comments on commit 3db9bce

Please sign in to comment.