Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ jobs:
PACT_BROKER_TOKEN_PACT_FOUNDATION: ${{ secrets.PACT_BROKER_TOKEN_PACT_FOUNDATION }}
PACT_BROKER_FEATURES: ${{ matrix.feature }}
TEST_FEATURE: ${{ matrix.feature }}
pact-v2:
runs-on: "ubuntu-latest"
continue-on-error: true
strategy:
fail-fast: false
matrix:
feature: [""]
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
- run: "bundle install"
- name: Generate and publish pacts
run: |
rm -rf spec/pacts/*
bundle exec rake pact:v2:spec
can-i-deploy:
runs-on: "ubuntu-latest"
needs: pact
Expand Down
13 changes: 11 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ group :development do
gem 'fakefs', '~> 3.0'
gem 'webmock', '~> 3.0'
gem 'conventional-changelog', '~>1.3'
gem 'pact', '~> 1.16'
gem 'pact-support', '~> 1.16'
gem 'approvals', '0.1.7'
gem 'rspec-its', '~> 2.0'
gem 'pry-byebug'

if ENV['X_PACT_DEVELOPMENT'] == 'true'
gem 'pact', path: '../pact-ruby'
gem 'pact-ffi', path: '../pact-ffi'
else
gem 'pact'
gem 'pact-ffi'
end
# for pact/v2 with non rail apps
gem 'activesupport'
end

group :test do
gem 'faraday', '~>2.0'
gem 'faraday-retry', '~>2.0'
gem 'rackup', '~> 2.1'
gem 'rack', '~> 2.1'
end
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ task 'pact:list_provider_states' do
JSON.parse(File.read(pact_file))['interactions'].collect{ | interaction| interaction['providerState'] }
}.flatten.compact.sort.uniq
end

RSpec::Core::RakeTask.new('pact:v2:spec') do |task|
task.pattern = 'spec/pact/providers/**/*_spec.rb'
task.rspec_opts = ['-t pact']
end
223 changes: 15 additions & 208 deletions doc/pacts/markdown/Pact Broker Client - Pact Broker.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,6 @@

* [A request to mark a deployed version as not currently deploye](#a_request_to_mark_a_deployed_version_as_not_currently_deploye_given_a_currently_deployed_version_exists) given a currently deployed version exists

* [A request to publish a pact](#a_request_to_publish_a_pact_given_'Condor'_already_exist_in_the_pact-broker,_but_the_'Pricing_Service'_does_not) given 'Condor' already exist in the pact-broker, but the 'Pricing Service' does not

* [A request to publish a pact](#a_request_to_publish_a_pact_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker

* [A request to publish a pact](#a_request_to_publish_a_pact_given_an_error_occurs_while_publishing_a_pact) given an error occurs while publishing a pact

* [A request to publish a pact with method patch](#a_request_to_publish_a_pact_with_method_patch_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0) given the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0

* [A request to publish a pact with method put](#a_request_to_publish_a_pact_with_method_put_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0) given the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0

* [A request to publish contracts](#a_request_to_publish_contracts)

* [A request to record a deployment](#a_request_to_record_a_deployment_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_exists_with_a_test_environment_available_for_deployment) given version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment
Expand Down Expand Up @@ -1077,8 +1067,7 @@ Pact Broker will respond with:
"name": "Pricing Service"
},
"interactions": [

]
]
}
}
```
Expand Down Expand Up @@ -2118,194 +2107,6 @@ Pact Broker will respond with:
}
}
```
<a name="a_request_to_publish_a_pact_given_&#39;Condor&#39;_already_exist_in_the_pact-broker,_but_the_&#39;Pricing_Service&#39;_does_not"></a>
Given **'Condor' already exist in the pact-broker, but the 'Pricing Service' does not**, upon receiving **a request to publish a pact** from Pact Broker Client, with
```json
{
"method": "put",
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
"headers": {
"Content-Type": "application/json"
},
"body": {
"consumer": {
"name": "Condor"
},
"provider": {
"name": "Pricing Service"
},
"interactions": [

]
}
}
```
Pact Broker will respond with:
```json
{
"status": 201,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-pact-version": {
"href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/latest"
}
}
}
}
```
<a name="a_request_to_publish_a_pact_given_the_&#39;Pricing_Service&#39;_already_exists_in_the_pact-broker"></a>
Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to publish a pact** from Pact Broker Client, with
```json
{
"method": "put",
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
"headers": {
"Content-Type": "application/json"
},
"body": {
"consumer": {
"name": "Condor"
},
"provider": {
"name": "Pricing Service"
},
"interactions": [

]
}
}
```
Pact Broker will respond with:
```json
{
"status": 201,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-pact-version": {
"href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/latest"
}
}
}
}
```
<a name="a_request_to_publish_a_pact_given_an_error_occurs_while_publishing_a_pact"></a>
Given **an error occurs while publishing a pact**, upon receiving **a request to publish a pact** from Pact Broker Client, with
```json
{
"method": "put",
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
"headers": {
"Content-Type": "application/json"
},
"body": {
"consumer": {
"name": "Condor"
},
"provider": {
"name": "Pricing Service"
},
"interactions": [

]
}
}
```
Pact Broker will respond with:
```json
{
"status": 500,
"headers": {
"Content-Type": "application/hal+json"
},
"body": {
"error": {
"message": "An error occurred"
}
}
}
```
<a name="a_request_to_publish_a_pact_with_method_patch_given_the_&#39;Pricing_Service&#39;_and_&#39;Condor&#39;_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0"></a>
Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0**, upon receiving **a request to publish a pact with method patch** from Pact Broker Client, with
```json
{
"method": "patch",
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
"headers": {
"Content-Type": "application/json"
},
"body": {
"consumer": {
"name": "Condor"
},
"provider": {
"name": "Pricing Service"
},
"interactions": [

]
}
}
```
Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-pact-version": {
"href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/latest"
}
}
}
}
```
<a name="a_request_to_publish_a_pact_with_method_put_given_the_&#39;Pricing_Service&#39;_and_&#39;Condor&#39;_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0"></a>
Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0**, upon receiving **a request to publish a pact with method put** from Pact Broker Client, with
```json
{
"method": "put",
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
"headers": {
"Content-Type": "application/json"
},
"body": {
"consumer": {
"name": "Condor"
},
"provider": {
"name": "Pricing Service"
},
"interactions": [

]
}
}
```
Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-pact-version": {
"href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/latest"
}
}
}
}
```
<a name="a_request_to_publish_contracts"></a>
Upon receiving **a request to publish contracts** from Pact Broker Client, with
```json
Expand Down Expand Up @@ -2411,7 +2212,9 @@ Given **version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exis
"headers": {
"Content-Type": "application/json",
"Accept": "application/hal+json"
}
},
"body": {
}
}
```
Pact Broker will respond with:
Expand Down Expand Up @@ -2565,8 +2368,7 @@ Pact Broker will respond with:
"name": "Pricing Service"
},
"interactions": [

]
]
}
}
```
Expand Down Expand Up @@ -2638,8 +2440,7 @@ Pact Broker will respond with:
"name": "Pricing Service"
},
"interactions": [

]
]
}
}
```
Expand All @@ -2651,7 +2452,9 @@ Given **'Condor' exists in the pact-broker with version 1.3.0, tagged with 'prod
"path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
"headers": {
"Content-Type": "application/json"
}
},
"body": {
}
}
```
Pact Broker will respond with:
Expand All @@ -2678,7 +2481,9 @@ Given **'Condor' does not exist in the pact-broker**, upon receiving **a request
"path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
"headers": {
"Content-Type": "application/json"
}
},
"body": {
}
}
```
Pact Broker will respond with:
Expand All @@ -2705,7 +2510,9 @@ Given **'Condor' exists in the pact-broker**, upon receiving **a request to tag
"path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
"headers": {
"Content-Type": "application/json"
}
},
"body": {
}
}
```
Pact Broker will respond with:
Expand Down
2 changes: 1 addition & 1 deletion doc/pacts/markdown/Pact Broker Client - PactFlow.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ PactFlow will respond with:
}
],
"pb:branch-version": {
}
}
}
}
}
Expand Down
Loading