pact_broker-client 1.43.0 → 1.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +21 -0
  3. data/CHANGELOG.md +13 -0
  4. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +0 -281
  5. data/lib/pact_broker/client/cli/broker.rb +3 -55
  6. data/lib/pact_broker/client/cli/deployment_commands.rb +74 -0
  7. data/lib/pact_broker/client/cli/pacticipant_commands.rb +9 -0
  8. data/lib/pact_broker/client/deployments.rb +4 -0
  9. data/lib/pact_broker/client/deployments/record_deployment.rb +38 -0
  10. data/lib/pact_broker/client/deployments/record_release.rb +99 -0
  11. data/lib/pact_broker/client/deployments/record_undeployment.rb +120 -0
  12. data/lib/pact_broker/client/describe_text_formatter.rb +23 -0
  13. data/lib/pact_broker/client/environments.rb +6 -3
  14. data/lib/pact_broker/client/environments/describe_environment.rb +3 -13
  15. data/lib/pact_broker/client/hal/entity.rb +5 -2
  16. data/lib/pact_broker/client/hal/http_client.rb +3 -2
  17. data/lib/pact_broker/client/pacticipants.rb +3 -3
  18. data/lib/pact_broker/client/pacticipants/create.rb +1 -1
  19. data/lib/pact_broker/client/pacticipants/describe.rb +33 -0
  20. data/lib/pact_broker/client/version.rb +1 -1
  21. data/lib/pact_broker/client/versions.rb +4 -1
  22. data/lib/pact_broker/client/versions/describe.rb +3 -1
  23. data/lib/pact_broker/client/versions/formatter.rb +3 -1
  24. data/lib/pact_broker/client/versions/json_formatter.rb +5 -3
  25. data/lib/pact_broker/client/versions/text_formatter.rb +3 -1
  26. data/script/record-deployments-and-releases.sh +10 -0
  27. data/spec/fixtures/approvals/describe_pacticipant.approved.txt +2 -0
  28. data/spec/integration/describe_environment_spec.rb +31 -0
  29. data/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb +204 -0
  30. data/spec/pacts/pact_broker_client-pact_broker.json +0 -288
  31. data/spec/service_providers/publish_pacts_spec.rb +3 -1
  32. data/spec/service_providers/record_deployment_spec.rb +7 -29
  33. data/spec/service_providers/record_release_spec.rb +135 -0
  34. data/spec/spec_helper.rb +13 -2
  35. data/tasks/pact.rake +19 -1
  36. metadata +18 -6
  37. data/lib/pact_broker/client/versions/record_deployment.rb +0 -85
  38. data/lib/pact_broker/client/versions/record_undeployment.rb +0 -102
  39. data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +0 -75
@@ -18,7 +18,7 @@ module PactBroker
18
18
  end
19
19
 
20
20
  def get href, params = {}, headers = {}
21
- query = params.collect{ |(key, value)| "#{CGI::escape(key.to_s)}=#{CGI::escape(value)}" }.join("&")
21
+ query = params.collect{ |(key, value)| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}" }.join("&")
22
22
  uri = URI(href)
23
23
  uri.query = query
24
24
  perform_request(create_request(uri, 'Get', nil, headers), uri)
@@ -46,7 +46,8 @@ module PactBroker
46
46
 
47
47
  def create_request uri, http_method, body = nil, headers = {}
48
48
  request = Net::HTTP.const_get(http_method).new(uri.request_uri)
49
- request['Content-Type'] = "application/json" if ['Post', 'Put', 'Patch'].include?(http_method)
49
+ request['Content-Type'] ||= "application/json" if ['Post', 'Put'].include?(http_method)
50
+ request['Content-Type'] ||= "application/merge-patch+json" if ['Patch'].include?(http_method)
50
51
  request['Accept'] = "application/hal+json"
51
52
  headers.each do | key, value |
52
53
  request[key] = value
@@ -1,7 +1,7 @@
1
1
  # New code
2
- Dir.glob(File.join(__FILE__.gsub(".rb", "/**/*.rb"))).sort.each do | path |
3
- require path
4
- end
2
+ require 'pact_broker/client/pacticipants/create'
3
+ require 'pact_broker/client/pacticipants/describe'
4
+ require 'pact_broker/client/pacticipants/list'
5
5
 
6
6
  # Old code
7
7
  require 'pact_broker/client/base_client'
@@ -17,7 +17,7 @@ module PactBroker
17
17
  index_resource._link!('pb:pacticipants').post!(pacticipant_resource_params)
18
18
  elsif pacticipant_entity.success?
19
19
  @action = "updated"
20
- pacticipant_entity._link!('self').patch!(pacticipant_resource_params)
20
+ pacticipant_entity._link!('self').patch!(pacticipant_resource_params, { "Content-Type" => "application/json" })
21
21
  else
22
22
  pacticipant_entity.assert_success!
23
23
  end
@@ -0,0 +1,33 @@
1
+ require 'pact_broker/client/base_command'
2
+ require 'pact_broker/client/describe_text_formatter'
3
+
4
+ module PactBroker
5
+ module Client
6
+ module Pacticipants2
7
+ class Describe < PactBroker::Client::BaseCommand
8
+
9
+ private
10
+
11
+ def do_call
12
+ PactBroker::Client::CommandResult.new(true, result_message)
13
+ end
14
+
15
+ def pacticipant_entity
16
+ @pacticipant_entity ||= index_resource._link('pb:pacticipant').expand('pacticipant' => params[:name]).get!
17
+ end
18
+
19
+ def result_message
20
+ if json_output?
21
+ pacticipant_entity.response.raw_body
22
+ else
23
+ properties = pacticipant_entity.response.body.except("_links", "_embedded")
24
+ if pacticipant_entity._embedded && pacticipant_entity._embedded["labels"] && pacticipant_entity._embedded["labels"].any?
25
+ properties["labels"] = pacticipant_entity._embedded["labels"]
26
+ end
27
+ PactBroker::Client::DescribeTextFormatter.call(properties)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.43.0'
3
+ VERSION = '1.44.0'
4
4
  end
5
5
  end
@@ -1,4 +1,7 @@
1
- require_relative 'base_client'
1
+ require 'pact_broker/client/base_client'
2
+ require 'pact_broker/client/versions/describe'
3
+
4
+ # Old code
2
5
  require 'pact_broker/client/pacts'
3
6
 
4
7
  module PactBroker
@@ -1,9 +1,11 @@
1
+ # Need Versions class to extend BaseClient until we can remove the old Versions code
2
+ require 'pact_broker/client/base_client'
1
3
  require 'pact_broker/client/pact_broker_client'
2
4
  require 'pact_broker/client/versions/formatter'
3
5
 
4
6
  module PactBroker
5
7
  module Client
6
- class Versions
8
+ class Versions < BaseClient
7
9
  class Describe
8
10
 
9
11
  class Result
@@ -1,9 +1,11 @@
1
+ # Need Versions class to extend BaseClient until we can remove the old Versions code
2
+ require 'pact_broker/client/base_client'
1
3
  require 'pact_broker/client/versions/json_formatter'
2
4
  require 'pact_broker/client/versions/text_formatter'
3
5
 
4
6
  module PactBroker
5
7
  module Client
6
- class Versions
8
+ class Versions < BaseClient
7
9
  class Formatter
8
10
  def self.call(matrix_lines, format)
9
11
  formatter = case format
@@ -1,11 +1,13 @@
1
+ # Need Versions class to extend BaseClient until we can remove the old Versions code
2
+ require 'pact_broker/client/base_client'
1
3
  require 'table_print'
2
4
 
3
5
  module PactBroker
4
6
  module Client
5
- class Versions
7
+ class Versions < BaseClient
6
8
  class JsonFormatter
7
- def self.call(matrix)
8
- JSON.pretty_generate(matrix)
9
+ def self.call(version)
10
+ JSON.pretty_generate(version)
9
11
  end
10
12
  end
11
13
  end
@@ -1,8 +1,10 @@
1
+ # Need Versions class to extend BaseClient until we can remove the old Versions code
2
+ require 'pact_broker/client/base_client'
1
3
  require 'table_print'
2
4
 
3
5
  module PactBroker
4
6
  module Client
5
- class Versions
7
+ class Versions < BaseClient
6
8
  class TextFormatter
7
9
 
8
10
  Line = Struct.new(:number, :tags)
@@ -0,0 +1,10 @@
1
+ export PACT_BROKER_FEATURES=deployments
2
+
3
+ bundle exec bin/pact-broker create-or-update-pacticipant --name Foo
4
+ bundle exec bin/pact-broker create-version-tag --pacticipant Foo --version 2 --tag main --auto-create-version
5
+ bundle exec bin/pact-broker describe-version --pacticipant Foo --version 2
6
+ bundle exec bin/pact-broker create-environment --name test
7
+ bundle exec bin/pact-broker can-i-deploy --pacticipant Foo --version 2 --to-environment test
8
+ bundle exec bin/pact-broker record-deployment --pacticipant Foo --version 2 --environment test --target foo
9
+ bundle exec bin/pact-broker record-undeployment --pacticipant Foo --version 2 --environment test --target foo
10
+ bundle exec bin/pact-broker record-release --pacticipant Foo --version 2 --environment test
@@ -0,0 +1,2 @@
1
+ Name: Pricing Service
2
+ Repository Url: git@git.realestate.com.au:business-systems/pricing-service
@@ -0,0 +1,31 @@
1
+ require 'pact_broker/client/cli/broker'
2
+
3
+ RSpec.describe "describe-environment" do
4
+ let(:index_body_hash) do
5
+ {
6
+ _links: {
7
+ "pb:pacticipant" => {
8
+ href: "http://broker/pacticipants/{pacticipant}"
9
+ }
10
+ }
11
+ }
12
+ end
13
+
14
+ let(:pacticipant_body_hash) { JSON.parse(File.read("./spec/support/pacticipant_get.json")) }
15
+
16
+ let!(:index_request) do
17
+ stub_request(:get, "http://broker").to_return(status: 200, body: index_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
18
+ end
19
+
20
+ let!(:pacticipant_request) do
21
+ stub_request(:get, "http://broker/pacticipants/Foo").to_return(status: 200, body: pacticipant_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
22
+ end
23
+
24
+ let(:parameters) { %w{describe-pacticipant --name Foo --broker-base-url http://broker} }
25
+
26
+ subject { capture(:stdout) { PactBroker::Client::CLI::Broker.start(parameters) } }
27
+
28
+ it "prints the pacticipant properties" do
29
+ Approvals.verify(subject, :name => "describe_pacticipant", format: :txt)
30
+ end
31
+ end
@@ -0,0 +1,204 @@
1
+ require 'pact_broker/client/deployments/record_deployment'
2
+
3
+ module PactBroker
4
+ module Client
5
+ module Deployments
6
+ describe RecordDeployment do
7
+ describe ".call" do
8
+ let(:broker_base_url) { "http://broker" }
9
+ let(:index_body_hash) do
10
+ {
11
+ _links: {
12
+ "pb:environments" => { href: "#{broker_base_url}/environments" },
13
+ "pb:pacticipant-version" => {
14
+ href: "#{broker_base_url}/pacticipants/{pacticipant}/versions/{version}"
15
+ }
16
+ }
17
+ }
18
+ end
19
+ let(:version_body_hash) do
20
+ {
21
+ "_links" => {
22
+ "pb:record-deployment" => [
23
+ {
24
+ name: "test",
25
+ href: "#{broker_base_url}/record-deployment"
26
+ }
27
+ ]
28
+ }
29
+ }
30
+ end
31
+ let(:environments_body_hash) do
32
+ {
33
+ "_links" => {
34
+ "pb:environments" => [
35
+ {
36
+ "name" => "test",
37
+ "href" => ""
38
+ }
39
+ ]
40
+ }
41
+
42
+ }
43
+ end
44
+ let(:record_deployment_body_hash) do
45
+ { "some" => "response" }
46
+ end
47
+ let!(:index_request) do
48
+ stub_request(:get, broker_base_url).to_return(status: 200, body: index_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
49
+ end
50
+ let!(:version_request) do
51
+ stub_request(:get, broker_base_url + "/pacticipants/Foo/versions/1").to_return(status: 200, body: version_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
52
+ end
53
+
54
+ let!(:environments_request) do
55
+ stub_request(:get, "http://broker/environments").
56
+ with(headers: { 'Accept'=>'application/hal+json' }).
57
+ to_return(status: 200, body: environments_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" })
58
+ end
59
+ let!(:record_deployment_request) do
60
+ stub_request(:post, "http://broker/record-deployment").
61
+ to_return(status: 200, body: record_deployment_body_hash.to_json , headers: {})
62
+ end
63
+
64
+ let(:target) { "blue" }
65
+
66
+ let(:params) do
67
+ {
68
+ pacticipant_name: "Foo",
69
+ version_number: "1",
70
+ environment_name: "test",
71
+ target: target
72
+ }
73
+ end
74
+
75
+ let(:options) do
76
+ {
77
+ output: output,
78
+ verbose: true
79
+ }
80
+ end
81
+ let(:output) { "text" }
82
+ let(:pact_broker_client_options) { { pact_broker_base_url: broker_base_url} }
83
+
84
+ subject { RecordDeployment.call(params, options, pact_broker_client_options) }
85
+
86
+ context "when the pb:environments relation does not exist" do
87
+ let(:index_body_hash) do
88
+ {
89
+ "_links" => {}
90
+ }
91
+ end
92
+ it "returns an error response" do
93
+ expect(subject.success).to be false
94
+ expect(subject.message).to include "does not support"
95
+ end
96
+ end
97
+
98
+ context "when the specified version does not exist" do
99
+ let!(:version_request) do
100
+ stub_request(:get, broker_base_url + "/pacticipants/Foo/versions/1").to_return(status: 404)
101
+ end
102
+
103
+ it "returns an error response" do
104
+ expect(subject.success).to be false
105
+ expect(subject.message).to include "Foo version 1 not found"
106
+ end
107
+ end
108
+
109
+ context "when the pacticipant version does not support recording deployments" do
110
+ let(:version_body_hash) do
111
+ {
112
+ "_links" => {}
113
+ }
114
+ end
115
+ it "returns an error response" do
116
+ expect(subject.success).to be false
117
+ expect(subject.message).to include "does not support"
118
+ end
119
+ end
120
+
121
+ context "when the specified environment is not available for recording a deployment" do
122
+ let(:version_body_hash) do
123
+ {
124
+ "_links" => {
125
+ "pb:record-deployment" => [
126
+ {
127
+ "name" => "prod",
128
+ "href" => ""
129
+ }
130
+ ]
131
+ }
132
+ }
133
+ end
134
+
135
+ context "when the environment does not exist" do
136
+ let(:environments_body_hash) do
137
+ {
138
+ "_links" => {
139
+ "pb:environments" => [
140
+ {
141
+ "name" => "prod",
142
+ "href" => ""
143
+ },{
144
+ "name" => "uat",
145
+ "href" => ""
146
+ }
147
+ ]
148
+ }
149
+ }
150
+ end
151
+
152
+ it "returns an error response" do
153
+ expect(subject.success).to be false
154
+ expect(subject.message).to include "No environment found with name 'test'. Available options: prod"
155
+ end
156
+ end
157
+
158
+ context "when the environment does exist" do
159
+ it "returns an error response" do
160
+ expect(subject.success).to be false
161
+ expect(subject.message).to include "Environment 'test' is not an available option for recording a deployment of Foo. Available options: prod"
162
+ end
163
+ end
164
+ end
165
+
166
+ context "when the output is json" do
167
+ let(:output) { "json" }
168
+
169
+ it "returns the JSON payload" do
170
+ expect(JSON.parse(subject.message)).to eq record_deployment_body_hash
171
+ end
172
+ end
173
+
174
+ context "when the response headers contain Pactflow" do
175
+ before do
176
+ allow_any_instance_of(RecordDeployment).to receive(:check_if_command_supported)
177
+ allow_any_instance_of(RecordDeployment).to receive(:check_environment_exists)
178
+ allow_any_instance_of(RecordDeployment).to receive(:record_action)
179
+ allow_any_instance_of(RecordDeployment).to receive(:index_resource).and_return(index_resource)
180
+ end
181
+
182
+ let(:response_headers) { { "X-Pactflow-Sha" => "abc" } }
183
+
184
+ let(:index_resource) do
185
+ double('PactBroker::Client::Hal::Entity', response: double('response', headers: response_headers) )
186
+ end
187
+
188
+ it "indicates the API was Pactflow" do
189
+ expect(subject.message).to include "Recorded deployment of Foo version 1 to test environment (target blue) in Pactflow"
190
+ end
191
+
192
+ context "when target is nil" do
193
+ let(:target) { nil }
194
+
195
+ it "does not include the target in the result message" do
196
+ expect(subject.message).to include "Recorded deployment of Foo version 1 to test environment in"
197
+ end
198
+ end
199
+ end
200
+ end
201
+ end
202
+ end
203
+ end
204
+ end
@@ -1638,294 +1638,6 @@
1638
1638
  }
1639
1639
  }
1640
1640
  },
1641
- {
1642
- "description": "a request for the index resource",
1643
- "providerState": "the pb:publish-contracts relations exists in the index resource",
1644
- "request": {
1645
- "method": "GET",
1646
- "path": "/",
1647
- "headers": {
1648
- "Accept": "application/hal+json"
1649
- }
1650
- },
1651
- "response": {
1652
- "status": 200,
1653
- "headers": {
1654
- "Content-Type": "application/hal+json;charset=utf-8"
1655
- },
1656
- "body": {
1657
- "_links": {
1658
- "pb:publish-contracts": {
1659
- "href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS"
1660
- }
1661
- }
1662
- },
1663
- "matchingRules": {
1664
- "$.body._links.pb:publish-contracts.href": {
1665
- "match": "regex",
1666
- "regex": "http:\\/\\/.*"
1667
- }
1668
- }
1669
- }
1670
- },
1671
- {
1672
- "description": "a request to publish contracts",
1673
- "request": {
1674
- "method": "POST",
1675
- "path": "/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS",
1676
- "headers": {
1677
- "Content-Type": "application/json",
1678
- "Accept": "application/hal+json"
1679
- },
1680
- "body": {
1681
- "pacticipantName": "Foo",
1682
- "pacticipantVersionNumber": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1683
- "branch": "main",
1684
- "tags": [
1685
- "dev"
1686
- ],
1687
- "buildUrl": "http://build",
1688
- "contracts": [
1689
- {
1690
- "consumerName": "Foo",
1691
- "providerName": "Bar",
1692
- "specification": "pact",
1693
- "contentType": "application/json",
1694
- "content": "eyJjb25zdW1lciI6eyJuYW1lIjoiRm9vIn0sInByb3ZpZGVyIjp7Im5hbWUiOiJCYXIifSwiaW50ZXJhY3Rpb25zIjpbeyJkZXNjcmlwdGlvbiI6ImFuIGV4YW1wbGUgcmVxdWVzdCIsInByb3ZpZGVyU3RhdGUiOiJhIHByb3ZpZGVyIHN0YXRlIiwicmVxdWVzdCI6eyJtZXRob2QiOiJHRVQiLCJwYXRoIjoiLyIsImhlYWRlcnMiOnt9fSwicmVzcG9uc2UiOnsic3RhdHVzIjoyMDAsImhlYWRlcnMiOnsiQ29udGVudC1UeXBlIjoiYXBwbGljYXRpb24vaGFsK2pzb24ifX19XSwibWV0YWRhdGEiOnsicGFjdFNwZWNpZmljYXRpb24iOnsidmVyc2lvbiI6IjIuMC4wIn19fQ==",
1695
- "writeMode": "overwrite",
1696
- "onConflict": "overwrite"
1697
- }
1698
- ]
1699
- }
1700
- },
1701
- "response": {
1702
- "status": 200,
1703
- "headers": {
1704
- "Content-Type": "application/hal+json;charset=utf-8"
1705
- },
1706
- "body": {
1707
- "_embedded": {
1708
- "pacticipant": {
1709
- "name": "Foo"
1710
- },
1711
- "version": {
1712
- "number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1713
- "buildUrl": "http://build"
1714
- }
1715
- },
1716
- "logs": [
1717
- {
1718
- "level": "info",
1719
- "message": "some message"
1720
- }
1721
- ],
1722
- "_links": {
1723
- "pb:pacticipant-version-tags": [
1724
- {
1725
- "name": "dev"
1726
- }
1727
- ],
1728
- "pb:contracts": [
1729
- {
1730
- "href": "http://some-pact"
1731
- }
1732
- ]
1733
- }
1734
- },
1735
- "matchingRules": {
1736
- "$.body.logs": {
1737
- "min": 1
1738
- },
1739
- "$.body.logs[*].*": {
1740
- "match": "type"
1741
- },
1742
- "$.body._links.pb:contracts[0].href": {
1743
- "match": "type"
1744
- }
1745
- }
1746
- }
1747
- },
1748
- {
1749
- "description": "a request for the index resource",
1750
- "providerState": "the pb:pacticipant-version and pb:environments relations exist in the index resource",
1751
- "request": {
1752
- "method": "GET",
1753
- "path": "/",
1754
- "headers": {
1755
- "Accept": "application/hal+json"
1756
- }
1757
- },
1758
- "response": {
1759
- "status": 200,
1760
- "headers": {
1761
- "Content-Type": "application/hal+json;charset=utf-8"
1762
- },
1763
- "body": {
1764
- "_links": {
1765
- "pb:pacticipant-version": {
1766
- "href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-{pacticipant}-{version}"
1767
- },
1768
- "pb:environments": {
1769
- "href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS"
1770
- }
1771
- }
1772
- },
1773
- "matchingRules": {
1774
- "$.body._links.pb:pacticipant-version.href": {
1775
- "match": "regex",
1776
- "regex": "http:\\/\\/.*{pacticipant}.*{version}"
1777
- },
1778
- "$.body._links.pb:environments.href": {
1779
- "match": "regex",
1780
- "regex": "http:\\/\\/.*"
1781
- }
1782
- }
1783
- }
1784
- },
1785
- {
1786
- "description": "a request for a pacticipant version",
1787
- "providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment",
1788
- "request": {
1789
- "method": "GET",
1790
- "path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1791
- "headers": {
1792
- "Accept": "application/hal+json"
1793
- }
1794
- },
1795
- "response": {
1796
- "status": 200,
1797
- "headers": {
1798
- "Content-Type": "application/hal+json;charset=utf-8"
1799
- },
1800
- "body": {
1801
- "_links": {
1802
- "pb:record-deployment": [
1803
- {
1804
- "name": "test",
1805
- "href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST"
1806
- }
1807
- ]
1808
- }
1809
- },
1810
- "matchingRules": {
1811
- "$.body._links.pb:record-deployment[0].href": {
1812
- "match": "regex",
1813
- "regex": "http:\\/\\/.*"
1814
- }
1815
- }
1816
- }
1817
- },
1818
- {
1819
- "description": "a request to record a deployment",
1820
- "providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment",
1821
- "request": {
1822
- "method": "POST",
1823
- "path": "/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST",
1824
- "headers": {
1825
- "Content-Type": "application/json",
1826
- "Accept": "application/hal+json"
1827
- },
1828
- "body": {
1829
- "target": "blue"
1830
- }
1831
- },
1832
- "response": {
1833
- "status": 201,
1834
- "headers": {
1835
- "Content-Type": "application/hal+json;charset=utf-8"
1836
- },
1837
- "body": {
1838
- "target": "blue"
1839
- }
1840
- }
1841
- },
1842
- {
1843
- "description": "a request for a pacticipant version",
1844
- "providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo does not exist",
1845
- "request": {
1846
- "method": "GET",
1847
- "path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1848
- "headers": {
1849
- "Accept": "application/hal+json"
1850
- }
1851
- },
1852
- "response": {
1853
- "status": 404,
1854
- "headers": {
1855
- }
1856
- }
1857
- },
1858
- {
1859
- "description": "a request for a pacticipant version",
1860
- "providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with 2 environments that aren't test available for deployment",
1861
- "request": {
1862
- "method": "GET",
1863
- "path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1864
- "headers": {
1865
- "Accept": "application/hal+json"
1866
- }
1867
- },
1868
- "response": {
1869
- "status": 200,
1870
- "headers": {
1871
- "Content-Type": "application/hal+json;charset=utf-8"
1872
- },
1873
- "body": {
1874
- "_links": {
1875
- "pb:record-deployment": [
1876
- {
1877
- "name": "prod",
1878
- "href": "href"
1879
- },
1880
- {
1881
- "name": "dev",
1882
- "href": "href"
1883
- }
1884
- ]
1885
- }
1886
- },
1887
- "matchingRules": {
1888
- "$.body._links.pb:record-deployment[0]": {
1889
- "match": "type"
1890
- },
1891
- "$.body._links.pb:record-deployment[1]": {
1892
- "match": "type"
1893
- }
1894
- }
1895
- }
1896
- },
1897
- {
1898
- "description": "a request for the environments",
1899
- "providerState": "an environment with name test exists",
1900
- "request": {
1901
- "method": "GET",
1902
- "path": "/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS",
1903
- "headers": {
1904
- "Accept": "application/hal+json"
1905
- }
1906
- },
1907
- "response": {
1908
- "status": 200,
1909
- "headers": {
1910
- "Content-Type": "application/hal+json;charset=utf-8"
1911
- },
1912
- "body": {
1913
- "_links": {
1914
- "pb:environments": [
1915
- {
1916
- "name": "test",
1917
- "href": "href"
1918
- }
1919
- ]
1920
- }
1921
- },
1922
- "matchingRules": {
1923
- "$.body._links.pb:environments[0].href": {
1924
- "match": "type"
1925
- }
1926
- }
1927
- }
1928
- },
1929
1641
  {
1930
1642
  "description": "a request to create a webhook with a JSON body for a consumer and provider",
1931
1643
  "providerState": "the 'Pricing Service' and 'Condor' already exist in the pact-broker",