pact_broker-client 1.38.3 → 1.43.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +47 -0
- data/Gemfile +4 -0
- data/README.md +57 -18
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +182 -2
- data/example/scripts/publish-pact.sh +1 -1
- data/lib/pact_broker/client/backports.rb +9 -0
- data/lib/pact_broker/client/base_command.rb +95 -0
- data/lib/pact_broker/client/can_i_deploy.rb +20 -3
- data/lib/pact_broker/client/cli/broker.rb +41 -28
- data/lib/pact_broker/client/cli/custom_thor.rb +12 -0
- data/lib/pact_broker/client/cli/environment_commands.rb +70 -0
- data/lib/pact_broker/client/cli/pacticipant_commands.rb +44 -0
- data/lib/pact_broker/client/cli/record_deployment_long_desc.txt +0 -0
- data/lib/pact_broker/client/cli/version_selector_options_parser.rb +4 -0
- data/lib/pact_broker/client/colorize_notices.rb +31 -0
- data/lib/pact_broker/client/environments.rb +3 -0
- data/lib/pact_broker/client/environments/create_environment.rb +31 -0
- data/lib/pact_broker/client/environments/delete_environment.rb +27 -0
- data/lib/pact_broker/client/environments/describe_environment.rb +36 -0
- data/lib/pact_broker/client/environments/environment_command.rb +66 -0
- data/lib/pact_broker/client/environments/list_environments.rb +30 -0
- data/lib/pact_broker/client/environments/text_formatter.rb +30 -0
- data/lib/pact_broker/client/environments/update_environment.rb +31 -0
- data/lib/pact_broker/client/generate_display_name.rb +27 -0
- data/lib/pact_broker/client/hal/entity.rb +26 -3
- data/lib/pact_broker/client/hal/http_client.rb +11 -2
- data/lib/pact_broker/client/hal/link.rb +20 -0
- data/lib/pact_broker/client/hal/links.rb +15 -0
- data/lib/pact_broker/client/hal_client_methods.rb +9 -3
- data/lib/pact_broker/client/matrix.rb +4 -0
- data/lib/pact_broker/client/matrix/abbreviate_version_number.rb +15 -0
- data/lib/pact_broker/client/matrix/resource.rb +26 -1
- data/lib/pact_broker/client/matrix/text_formatter.rb +28 -17
- data/lib/pact_broker/client/pacticipants.rb +6 -0
- data/lib/pact_broker/client/pacticipants/create.rb +24 -34
- data/lib/pact_broker/client/pacticipants/list.rb +34 -0
- data/lib/pact_broker/client/pacticipants/text_formatter.rb +41 -0
- data/lib/pact_broker/client/pacts.rb +0 -1
- data/lib/pact_broker/client/publish_pacts.rb +94 -128
- data/lib/pact_broker/client/publish_pacts_the_old_way.rb +194 -0
- data/lib/pact_broker/client/string_refinements.rb +56 -0
- data/lib/pact_broker/client/tasks/publication_task.rb +3 -3
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/versions/record_deployment.rb +14 -38
- data/lib/pact_broker/client/versions/record_undeployment.rb +45 -68
- data/pact-broker-client.gemspec +2 -0
- data/script/approve-all.sh +6 -0
- data/script/publish-pact.sh +36 -5
- data/script/record-deployment.sh +1 -3
- data/script/record-undeployment.sh +4 -0
- data/spec/fixtures/approvals/can_i_deploy_ignore.approved.txt +13 -0
- data/spec/fixtures/approvals/describe_environment.approved.txt +7 -0
- data/spec/fixtures/approvals/list_environments.approved.txt +3 -0
- data/spec/fixtures/foo-bar.json +31 -0
- data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +47 -5
- data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +5 -5
- data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +36 -7
- data/spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb +3 -3
- data/spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb +21 -0
- data/spec/lib/pact_broker/client/environments/delete_environment_spec.rb +120 -0
- data/spec/lib/pact_broker/client/environments/describe_environment_spec.rb +89 -0
- data/spec/lib/pact_broker/client/environments/update_environment_spec.rb +167 -0
- data/spec/lib/pact_broker/client/generate_display_name_spec.rb +39 -0
- data/spec/lib/pact_broker/client/hal/entity_spec.rb +2 -2
- data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +5 -2
- data/spec/lib/pact_broker/client/{publish_pacts_spec.rb → publish_pacts_the_old_way_spec.rb} +10 -9
- data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +18 -12
- data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +17 -24
- data/spec/pacts/pact_broker_client-pact_broker.json +197 -2
- data/spec/service_providers/create_environment_spec.rb +78 -0
- data/spec/service_providers/list_environments_spec.rb +77 -0
- data/spec/service_providers/pact_broker_client_create_version_spec.rb +4 -4
- data/spec/service_providers/pact_broker_client_matrix_ignore_spec.rb +98 -0
- data/spec/service_providers/pacticipants_create_spec.rb +5 -4
- data/spec/service_providers/publish_pacts_spec.rb +116 -0
- data/spec/service_providers/record_deployment_spec.rb +14 -11
- data/spec/spec_helper.rb +3 -1
- data/spec/support/approvals.rb +26 -0
- data/spec/support/shared_context.rb +6 -2
- metadata +86 -5
@@ -5,11 +5,14 @@ module PactBroker
|
|
5
5
|
module Pacticipants2
|
6
6
|
describe Create do
|
7
7
|
describe ".call" do
|
8
|
-
|
8
|
+
before do
|
9
|
+
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:sleep)
|
10
|
+
end
|
11
|
+
let(:pact_broker_client_options) { { pact_broker_base_url: broker_base_url} }
|
9
12
|
let(:broker_base_url) { "http://url" }
|
10
13
|
let(:params) { { name: 'Foo' } }
|
11
14
|
|
12
|
-
subject { Create.call(params,
|
15
|
+
subject { Create.call(params, {}, pact_broker_client_options)}
|
13
16
|
|
14
17
|
context "when there is an http error" do
|
15
18
|
let!(:index_request) do
|
data/spec/lib/pact_broker/client/{publish_pacts_spec.rb → publish_pacts_the_old_way_spec.rb}
RENAMED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'fakefs/safe'
|
3
|
-
require 'pact_broker/client/
|
3
|
+
require 'pact_broker/client/publish_pacts_the_old_way'
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
module PactBroker
|
7
7
|
module Client
|
8
|
-
describe
|
8
|
+
describe PublishPactsTheOldWay do
|
9
9
|
|
10
10
|
# The amount of stubbing that we have to do here indicates this class is doing
|
11
11
|
# TOO MUCH and needs to be split up!
|
@@ -23,7 +23,7 @@ module PactBroker
|
|
23
23
|
File.open("spec/pacts/consumer-provider.json", "w") { |file| file << pact_hash.to_json }
|
24
24
|
File.open("spec/pacts/consumer-provider-2.json", "w") { |file| file << pact_hash.to_json }
|
25
25
|
File.open("spec/pacts/foo-bar.json", "w") { |file| file << pact_hash_2.to_json }
|
26
|
-
allow_any_instance_of(
|
26
|
+
allow_any_instance_of(PublishPactsTheOldWay).to receive(:create_index_entry_point).and_return(index_entry_point)
|
27
27
|
end
|
28
28
|
|
29
29
|
after do
|
@@ -63,8 +63,9 @@ module PactBroker
|
|
63
63
|
let(:index_entry_point) { instance_double("PactBroker::Client::Hal::EntryPoint", :get! => index_resource )}
|
64
64
|
let(:index_resource) { instance_double("PactBroker::Client::Hal::Entity", can?: can_create_version ) }
|
65
65
|
let(:can_create_version) { false }
|
66
|
+
let(:options) { {} }
|
66
67
|
|
67
|
-
subject {
|
68
|
+
subject { PublishPactsTheOldWay.new(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options) }
|
68
69
|
|
69
70
|
describe "call" do
|
70
71
|
it "creates a PactBroker Client" do
|
@@ -85,7 +86,7 @@ module PactBroker
|
|
85
86
|
end
|
86
87
|
|
87
88
|
it "returns true" do
|
88
|
-
expect(subject.call).to
|
89
|
+
expect(subject.call.success).to eq true
|
89
90
|
end
|
90
91
|
end
|
91
92
|
|
@@ -140,7 +141,7 @@ module PactBroker
|
|
140
141
|
end
|
141
142
|
|
142
143
|
it "returns false" do
|
143
|
-
expect(subject.call).to be false
|
144
|
+
expect(subject.call.success).to be false
|
144
145
|
end
|
145
146
|
end
|
146
147
|
|
@@ -212,7 +213,7 @@ module PactBroker
|
|
212
213
|
end
|
213
214
|
|
214
215
|
it "returns false" do
|
215
|
-
expect(subject.call).to eq false
|
216
|
+
expect(subject.call.success).to eq false
|
216
217
|
end
|
217
218
|
end
|
218
219
|
end
|
@@ -230,7 +231,7 @@ module PactBroker
|
|
230
231
|
end
|
231
232
|
|
232
233
|
it "returns false" do
|
233
|
-
expect(subject.call).to eq false
|
234
|
+
expect(subject.call.success).to eq false
|
234
235
|
end
|
235
236
|
end
|
236
237
|
|
@@ -255,7 +256,7 @@ module PactBroker
|
|
255
256
|
end
|
256
257
|
|
257
258
|
it "returns true" do
|
258
|
-
expect(subject.call).to eq true
|
259
|
+
expect(subject.call.success).to eq true
|
259
260
|
end
|
260
261
|
end
|
261
262
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'pact_broker/client/tasks/publication_task'
|
3
3
|
require 'pact_broker/client/publish_pacts'
|
4
|
+
require 'pact_broker/client/command_result'
|
4
5
|
|
5
6
|
module PactBroker::Client
|
6
7
|
describe PublicationTask do
|
@@ -9,13 +10,16 @@ module PactBroker::Client
|
|
9
10
|
@consumer_version = "1.2.3"
|
10
11
|
end
|
11
12
|
|
12
|
-
let(:publish_pacts) { instance_double("PactBroker::ClientSupport::PublishPacts", call:
|
13
|
+
let(:publish_pacts) { instance_double("PactBroker::ClientSupport::PublishPacts", call: result)}
|
13
14
|
let(:pact_file_list) { ['spec/pact/consumer-provider.json'] }
|
15
|
+
let(:success) { true }
|
16
|
+
let(:result) { instance_double(PactBroker::Client::CommandResult, success: success, message: "message")}
|
14
17
|
|
15
18
|
before do
|
16
19
|
allow(PactBroker::Client::PublishPacts).to receive(:new).and_return(publish_pacts)
|
17
20
|
allow(FileList).to receive(:[]).with(pattern).and_return(pact_file_list)
|
18
21
|
allow(PactBroker::Client::Git).to receive(:branch).and_return('foo')
|
22
|
+
allow($stdout).to receive(:puts)
|
19
23
|
end
|
20
24
|
|
21
25
|
let(:pattern) { "spec/pacts/*.json" }
|
@@ -29,15 +33,16 @@ module PactBroker::Client
|
|
29
33
|
|
30
34
|
context "when pacts are succesfully published" do
|
31
35
|
it "invokes PublishPacts with the default values" do
|
32
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: '1.2.3', branch: "foo", tags: [], version_required: false}, {}).and_return(publish_pacts)
|
33
|
-
expect(publish_pacts).to receive(:call).and_return(
|
36
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: '1.2.3', branch: "foo", tags: [], version_required: false}, {}, {}).and_return(publish_pacts)
|
37
|
+
expect(publish_pacts).to receive(:call).and_return(result)
|
34
38
|
Rake::Task['pact:publish'].execute
|
35
39
|
end
|
36
40
|
end
|
37
41
|
|
38
42
|
context "when a pact fails to be published" do
|
43
|
+
let(:success) { false }
|
44
|
+
|
39
45
|
it "raises an error" do
|
40
|
-
expect(publish_pacts).to receive(:call).and_return(false)
|
41
46
|
expect { Rake::Task['pact:publish'].execute }.to raise_error("One or more pacts failed to be published")
|
42
47
|
end
|
43
48
|
end
|
@@ -52,8 +57,8 @@ module PactBroker::Client
|
|
52
57
|
end
|
53
58
|
|
54
59
|
it "invokes PublishPacts with the write method set" do
|
55
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: "1.2.3", branch: "foo", tags: [], version_required: false }, {write: :merge}).and_return(publish_pacts)
|
56
|
-
expect(publish_pacts).to receive(:call).and_return(
|
60
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: "1.2.3", branch: "foo", tags: [], version_required: false }, {}, {write: :merge}).and_return(publish_pacts)
|
61
|
+
expect(publish_pacts).to receive(:call).and_return(result)
|
57
62
|
Rake::Task['pact:publish:merge'].execute
|
58
63
|
end
|
59
64
|
end
|
@@ -74,7 +79,7 @@ module PactBroker::Client
|
|
74
79
|
end
|
75
80
|
|
76
81
|
it "invokes PublishPacts with the git branch name as a tag" do
|
77
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(tags: ['bar', 'foo']), anything).and_return(publish_pacts)
|
82
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(tags: ['bar', 'foo']), anything, anything).and_return(publish_pacts)
|
78
83
|
Rake::Task['pact:publish:git_branch'].execute
|
79
84
|
end
|
80
85
|
end
|
@@ -93,7 +98,7 @@ module PactBroker::Client
|
|
93
98
|
end
|
94
99
|
|
95
100
|
it "invokes PublishPacts with the branch name" do
|
96
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything).and_return(publish_pacts)
|
101
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything, anything).and_return(publish_pacts)
|
97
102
|
Rake::Task['pact:publish:git_branch_auto_detect_true'].execute
|
98
103
|
end
|
99
104
|
end
|
@@ -113,7 +118,7 @@ module PactBroker::Client
|
|
113
118
|
end
|
114
119
|
|
115
120
|
it "invokes PublishPacts with the specified branch name" do
|
116
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "main"), anything).and_return(publish_pacts)
|
121
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "main"), anything, anything).and_return(publish_pacts)
|
117
122
|
Rake::Task['pact:publish:git_branch_auto_detect_true_with_branch'].execute
|
118
123
|
end
|
119
124
|
end
|
@@ -132,7 +137,7 @@ module PactBroker::Client
|
|
132
137
|
end
|
133
138
|
|
134
139
|
it "invokes PublishPacts without the branch name" do
|
135
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_not_including(branch: "foo"), anything).and_return(publish_pacts)
|
140
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_not_including(branch: "foo"), anything, anything).and_return(publish_pacts)
|
136
141
|
Rake::Task['pact:publish:git_branch_auto_detect_false'].execute
|
137
142
|
end
|
138
143
|
end
|
@@ -150,7 +155,7 @@ module PactBroker::Client
|
|
150
155
|
end
|
151
156
|
|
152
157
|
it "invokes PublishPacts with the branch name" do
|
153
|
-
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything).and_return(publish_pacts)
|
158
|
+
expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"),anything, anything).and_return(publish_pacts)
|
154
159
|
Rake::Task['pact:publish:git_branch_auto_detect_default'].execute
|
155
160
|
end
|
156
161
|
end
|
@@ -180,9 +185,10 @@ module PactBroker::Client
|
|
180
185
|
@pact_broker_base_url,
|
181
186
|
pact_file_list,
|
182
187
|
{ number: "1.2.3", tags: [@tag], branch: "foo", version_required: false},
|
188
|
+
{},
|
183
189
|
{ basic_auth: @pact_broker_basic_auth, token: @pact_broker_token }
|
184
190
|
)
|
185
|
-
expect(publish_pacts).to receive(:call).and_return(
|
191
|
+
expect(publish_pacts).to receive(:call).and_return(result)
|
186
192
|
Rake::Task['pact:publish:custom'].execute
|
187
193
|
end
|
188
194
|
end
|
@@ -15,21 +15,25 @@ module PactBroker
|
|
15
15
|
stub_request(:get, broker_base_url).to_return(status: 200, body: index_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
|
16
16
|
end
|
17
17
|
|
18
|
-
let(:
|
18
|
+
let(:target) { "blue" }
|
19
19
|
|
20
20
|
let(:params) do
|
21
21
|
{
|
22
22
|
pacticipant_name: "Foo",
|
23
23
|
version_number: "1",
|
24
24
|
environment_name: "test",
|
25
|
-
|
26
|
-
output: "text"
|
25
|
+
target: target
|
27
26
|
}
|
28
27
|
end
|
29
28
|
|
30
|
-
let(:
|
29
|
+
let(:options) do
|
30
|
+
{
|
31
|
+
output: "text"
|
32
|
+
}
|
33
|
+
end
|
34
|
+
let(:pact_broker_client_options) { { pact_broker_base_url: broker_base_url} }
|
31
35
|
|
32
|
-
subject { RecordDeployment.call(params,
|
36
|
+
subject { RecordDeployment.call(params, options, pact_broker_client_options) }
|
33
37
|
|
34
38
|
context "when the pb:environments relation does not exist" do
|
35
39
|
it "returns an error response" do
|
@@ -43,36 +47,25 @@ module PactBroker
|
|
43
47
|
allow_any_instance_of(RecordDeployment).to receive(:check_if_command_supported)
|
44
48
|
allow_any_instance_of(RecordDeployment).to receive(:check_environment_exists)
|
45
49
|
allow_any_instance_of(RecordDeployment).to receive(:record_deployment)
|
46
|
-
allow_any_instance_of(RecordDeployment).to receive(:
|
50
|
+
allow_any_instance_of(RecordDeployment).to receive(:index_resource).and_return(index_resource)
|
47
51
|
end
|
48
52
|
|
49
53
|
let(:response_headers) { { "X-Pactflow-Sha" => "abc" } }
|
50
54
|
|
51
|
-
let(:
|
55
|
+
let(:index_resource) do
|
52
56
|
double('PactBroker::Client::Hal::Entity', response: double('response', headers: response_headers) )
|
53
57
|
end
|
54
58
|
|
55
59
|
it "indicates the API was Pactflow" do
|
56
|
-
expect(subject.message).to include "Recorded deployment of Foo version 1 to test in Pactflow"
|
60
|
+
expect(subject.message).to include "Recorded deployment of Foo version 1 to test environment (target blue) in Pactflow"
|
57
61
|
end
|
58
|
-
end
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
allow_any_instance_of(RecordDeployment).to receive(:check_if_command_supported)
|
63
|
-
allow_any_instance_of(RecordDeployment).to receive(:check_environment_exists)
|
64
|
-
allow_any_instance_of(RecordDeployment).to receive(:record_deployment)
|
65
|
-
allow_any_instance_of(RecordDeployment).to receive(:pact_broker_name).and_return("")
|
66
|
-
end
|
67
|
-
|
68
|
-
let(:replaced_previous_deployed_version) { false }
|
69
|
-
|
70
|
-
let(:deployed_version_resource) do
|
71
|
-
double('PactBroker::Client::Hal::Entity', response: double('response', headers: response_headers) )
|
72
|
-
end
|
63
|
+
context "when target is nil" do
|
64
|
+
let(:target) { nil }
|
73
65
|
|
74
|
-
|
75
|
-
|
66
|
+
it "does not include the target in the result message" do
|
67
|
+
expect(subject.message).to include "Recorded deployment of Foo version 1 to test environment in"
|
68
|
+
end
|
76
69
|
end
|
77
70
|
end
|
78
71
|
end
|
@@ -292,6 +292,94 @@
|
|
292
292
|
}
|
293
293
|
}
|
294
294
|
},
|
295
|
+
{
|
296
|
+
"description": "a request to determine if Bar can be deployed with all Foo tagged prod, ignoring the verification for Foo version 3.4.5",
|
297
|
+
"providerState": "provider Bar version 4.5.6 has a successful verification for Foo version 1.2.3 tagged prod and a failed verification for version 3.4.5 tagged prod",
|
298
|
+
"request": {
|
299
|
+
"method": "get",
|
300
|
+
"path": "/matrix",
|
301
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Bar&q%5B%5D%5Bversion%5D=4.5.6&q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Btag%5D=prod&latestby=cvpv&ignore%5B%5D%5Bpacticipant%5D=Foo&ignore%5B%5D%5Bversion%5D=3.4.5"
|
302
|
+
},
|
303
|
+
"response": {
|
304
|
+
"status": 200,
|
305
|
+
"headers": {
|
306
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
307
|
+
},
|
308
|
+
"body": {
|
309
|
+
"summary": {
|
310
|
+
"deployable": true,
|
311
|
+
"ignored": 1
|
312
|
+
},
|
313
|
+
"notices": [
|
314
|
+
{
|
315
|
+
"text": "some notice",
|
316
|
+
"type": "info"
|
317
|
+
}
|
318
|
+
],
|
319
|
+
"matrix": [
|
320
|
+
{
|
321
|
+
"consumer": {
|
322
|
+
"name": "Foo",
|
323
|
+
"version": {
|
324
|
+
"number": "1.2.3"
|
325
|
+
}
|
326
|
+
},
|
327
|
+
"provider": {
|
328
|
+
"name": "Bar",
|
329
|
+
"version": {
|
330
|
+
"number": "4.5.6"
|
331
|
+
}
|
332
|
+
},
|
333
|
+
"verificationResult": {
|
334
|
+
"success": true,
|
335
|
+
"_links": {
|
336
|
+
"self": {
|
337
|
+
"href": "http://result"
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"consumer": {
|
344
|
+
"name": "Foo",
|
345
|
+
"version": {
|
346
|
+
"number": "3.4.5"
|
347
|
+
}
|
348
|
+
},
|
349
|
+
"provider": {
|
350
|
+
"name": "Bar",
|
351
|
+
"version": {
|
352
|
+
"number": "4.5.6"
|
353
|
+
}
|
354
|
+
},
|
355
|
+
"verificationResult": {
|
356
|
+
"success": false,
|
357
|
+
"_links": {
|
358
|
+
"self": {
|
359
|
+
"href": "http://result"
|
360
|
+
}
|
361
|
+
}
|
362
|
+
},
|
363
|
+
"ignored": true
|
364
|
+
}
|
365
|
+
]
|
366
|
+
},
|
367
|
+
"matchingRules": {
|
368
|
+
"$.body.notices": {
|
369
|
+
"min": 1
|
370
|
+
},
|
371
|
+
"$.body.notices[*].*": {
|
372
|
+
"match": "type"
|
373
|
+
},
|
374
|
+
"$.body.matrix[0].verificationResult._links.self.href": {
|
375
|
+
"match": "type"
|
376
|
+
},
|
377
|
+
"$.body.matrix[1].verificationResult._links.self.href": {
|
378
|
+
"match": "type"
|
379
|
+
}
|
380
|
+
}
|
381
|
+
}
|
382
|
+
},
|
295
383
|
{
|
296
384
|
"description": "a request for the compatibility matrix for Foo version 1.2.3 and Bar version 4.5.6",
|
297
385
|
"providerState": "the pact for Foo version 1.2.3 has been verified by Bar version 4.5.6",
|
@@ -1550,6 +1638,113 @@
|
|
1550
1638
|
}
|
1551
1639
|
}
|
1552
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
|
+
},
|
1553
1748
|
{
|
1554
1749
|
"description": "a request for the index resource",
|
1555
1750
|
"providerState": "the pb:pacticipant-version and pb:environments relations exist in the index resource",
|
@@ -1631,7 +1826,7 @@
|
|
1631
1826
|
"Accept": "application/hal+json"
|
1632
1827
|
},
|
1633
1828
|
"body": {
|
1634
|
-
"
|
1829
|
+
"target": "blue"
|
1635
1830
|
}
|
1636
1831
|
},
|
1637
1832
|
"response": {
|
@@ -1640,7 +1835,7 @@
|
|
1640
1835
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1641
1836
|
},
|
1642
1837
|
"body": {
|
1643
|
-
"
|
1838
|
+
"target": "blue"
|
1644
1839
|
}
|
1645
1840
|
}
|
1646
1841
|
},
|