pact_broker-client 1.38.2 → 1.42.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 +18 -0
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +61 -140
- data/example/scripts/publish-pact.sh +1 -1
- data/lib/pact_broker/client/backports.rb +9 -0
- data/lib/pact_broker/client/base_client.rb +1 -1
- 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 +44 -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 +6 -6
- 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 +5 -5
- data/spec/pacts/pact_broker_client-pact_broker.json +50 -124
- 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 +6 -7
- 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
data/pact-broker-client.gemspec
CHANGED
@@ -33,4 +33,6 @@ Gem::Specification.new do |gem|
|
|
33
33
|
gem.add_development_dependency 'conventional-changelog', '~>1.3'
|
34
34
|
gem.add_development_dependency 'pact', '~> 1.16'
|
35
35
|
gem.add_development_dependency 'pact-support', '~> 1.16'
|
36
|
+
gem.add_development_dependency 'approvals', '>=0.0.24', '<1.0.0'
|
37
|
+
gem.add_development_dependency 'rspec-its', '~> 1.3'
|
36
38
|
end
|
data/script/publish-pact.sh
CHANGED
@@ -1,7 +1,38 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
export PACT_BROKER_BASE_URL="http://localhost:9292"
|
2
|
+
export PACT_BROKER_TOKEN="localhost"
|
3
|
+
|
4
|
+
# bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
|
5
|
+
# --uuid d40f38c3-aaa3-47f5-9161-95c07bc16b14 \
|
6
|
+
# --request POST \
|
7
|
+
# --description "foo webhook" \
|
8
|
+
# --contract-published
|
9
|
+
|
10
|
+
bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
|
11
|
+
--uuid d40f38c3-aaa3-47f5-9161-95csfadfsd7 \
|
12
|
+
--description "This is quite a long description for a webhook that I hope will be truncated" \
|
13
|
+
--request POST \
|
14
|
+
--contract-published
|
15
|
+
|
16
|
+
# bundle exec bin/pact-broker publish spec/pacts/pact_broker_client-pact_broker.json spec/fixtures/foo-bar.json \
|
17
|
+
# --consumer-app-version 1.2.12 \
|
18
|
+
# --broker-base-url http://localhost:9292 \
|
19
|
+
# --broker-username localhost --broker-password localhost \
|
20
|
+
# --auto-detect-version-properties \
|
21
|
+
# --build-url http://mybuild \
|
22
|
+
# --branch master --tag foo5
|
23
|
+
|
24
|
+
# bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
|
25
|
+
# --uuid d40f38c3-aaa3-47f5-9161-95c07bc16555 \
|
26
|
+
# --provider Bar \
|
27
|
+
# --request POST \
|
28
|
+
# --contract-published
|
29
|
+
|
30
|
+
|
31
|
+
PACT_BROKER_FEATURES=publish_contracts bundle exec bin/pact-broker publish spec/pacts/pact_broker_client-pact_broker.json \
|
32
|
+
--consumer-app-version 1.2.26 \
|
3
33
|
--broker-base-url http://localhost:9292 \
|
4
|
-
--broker-
|
5
|
-
--auto-detect-
|
6
|
-
--build-url http://mybuild
|
34
|
+
--broker-token localhost \
|
35
|
+
--auto-detect-version-properties \
|
36
|
+
--build-url http://mybuild \
|
37
|
+
--branch master --tag foo5 --tag foo6
|
7
38
|
|
data/script/record-deployment.sh
CHANGED
@@ -1,4 +1,2 @@
|
|
1
1
|
PACT_BROKER_FEATURES=deployments bundle exec bin/pact-broker record-deployment \
|
2
|
-
--pacticipant
|
3
|
-
|
4
|
-
|
2
|
+
--pacticipant foo-consumer --version 1 --environment prod --broker-base-url http://localhost:9292
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[32mComputer says yes \o/ [0m
|
2
|
+
|
3
|
+
CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? | RESULT#
|
4
|
+
---------|-----------|----------|-----------|-----------------|--------
|
5
|
+
Foo | 1.2.3 | Bar | 4.5.6 | true | 1
|
6
|
+
Foo | 3.4.5 | Bar | 4.5.6 | false [ignored] | 2
|
7
|
+
|
8
|
+
VERIFICATION RESULTS
|
9
|
+
--------------------
|
10
|
+
1. http://result (success)
|
11
|
+
2. http://result (failure)
|
12
|
+
|
13
|
+
some notice
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"consumer": {
|
3
|
+
"name": "Foo"
|
4
|
+
},
|
5
|
+
"provider": {
|
6
|
+
"name": "Bar"
|
7
|
+
},
|
8
|
+
"interactions": [
|
9
|
+
{
|
10
|
+
"description": "an example request",
|
11
|
+
"providerState": "a provider state",
|
12
|
+
"request": {
|
13
|
+
"method": "GET",
|
14
|
+
"path": "/",
|
15
|
+
"headers": {
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"response": {
|
19
|
+
"status": 200,
|
20
|
+
"headers": {
|
21
|
+
"Content-Type": "application/hal+json"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
],
|
26
|
+
"metadata": {
|
27
|
+
"pactSpecification": {
|
28
|
+
"version": "2.0.0"
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
@@ -6,22 +6,27 @@ module PactBroker
|
|
6
6
|
describe CanIDeploy do
|
7
7
|
let(:pact_broker_base_url) { 'http://example.org' }
|
8
8
|
let(:version_selectors) { [{ pacticipant: "Foo", version: "1" }] }
|
9
|
-
let(:matrix_options) { {} }
|
9
|
+
let(:matrix_options) { { } }
|
10
10
|
let(:pact_broker_client_options) { { foo: 'bar' } }
|
11
11
|
let(:matrix_client) { instance_double('PactBroker::Client::Matrix') }
|
12
12
|
let(:matrix) do
|
13
13
|
instance_double('Matrix::Resource',
|
14
|
-
deployable?:
|
14
|
+
deployable?: deployable,
|
15
15
|
reason: 'some reason',
|
16
16
|
any_unknown?: any_unknown,
|
17
17
|
supports_unknown_count?: supports_unknown_count,
|
18
|
-
|
18
|
+
supports_ignore?: supports_ignore,
|
19
|
+
unknown_count: unknown_count,
|
20
|
+
notices: notices)
|
19
21
|
end
|
20
22
|
let(:unknown_count) { 0 }
|
21
23
|
let(:any_unknown) { unknown_count > 0 }
|
22
24
|
let(:supports_unknown_count) { true }
|
23
25
|
let(:retry_while_unknown) { 0 }
|
24
26
|
let(:options) { { output: 'text', retry_while_unknown: retry_while_unknown, retry_interval: 5 } }
|
27
|
+
let(:notices) { nil }
|
28
|
+
let(:supports_ignore) { true }
|
29
|
+
let(:deployable) { true }
|
25
30
|
|
26
31
|
|
27
32
|
before do
|
@@ -55,10 +60,19 @@ module PactBroker
|
|
55
60
|
it "returns a success reason" do
|
56
61
|
expect(subject.message).to include "some reason"
|
57
62
|
end
|
63
|
+
|
64
|
+
context "when there are notices" do
|
65
|
+
let(:notices) { [Notice.new(text: "some notice", type: "info")] }
|
66
|
+
|
67
|
+
it "returns the notices instead of the reason" do
|
68
|
+
expect(subject.message).to_not include "some reason"
|
69
|
+
expect(subject.message).to include "some notice"
|
70
|
+
end
|
71
|
+
end
|
58
72
|
end
|
59
73
|
|
60
74
|
context "when the versions are not deployable" do
|
61
|
-
let(:matrix) { instance_double('Matrix::Resource', deployable?: false, reason: 'some reason', any_unknown?: false) }
|
75
|
+
let(:matrix) { instance_double('Matrix::Resource', deployable?: false, reason: 'some reason', any_unknown?: false, notices: notices) }
|
62
76
|
|
63
77
|
it "returns a failure response" do
|
64
78
|
expect(subject.success).to be false
|
@@ -71,6 +85,15 @@ module PactBroker
|
|
71
85
|
it "returns a failure reason" do
|
72
86
|
expect(subject.message).to include "some reason"
|
73
87
|
end
|
88
|
+
|
89
|
+
context "when there are notices" do
|
90
|
+
let(:notices) { [Notice.new(text: "some notice", type: "info")] }
|
91
|
+
|
92
|
+
it "returns the notices instead of the reason" do
|
93
|
+
expect(subject.message).to_not include "some reason"
|
94
|
+
expect(subject.message).to include "some notice"
|
95
|
+
end
|
96
|
+
end
|
74
97
|
end
|
75
98
|
|
76
99
|
context "when retry_while_unknown is greater than 0" do
|
@@ -115,6 +138,25 @@ module PactBroker
|
|
115
138
|
end
|
116
139
|
end
|
117
140
|
|
141
|
+
context "when there are ignore selectors but the matrix does not support ignoring" do
|
142
|
+
let(:matrix_options) { { ignore_selectors: [{ pacticipant_name: "Foo" }]} }
|
143
|
+
let(:supports_ignore) { false }
|
144
|
+
|
145
|
+
context "when deployable" do
|
146
|
+
it "returns a warning" do
|
147
|
+
expect(subject.message).to include "does not support"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context "when not deployable" do
|
152
|
+
let(:deployable) { false }
|
153
|
+
|
154
|
+
it "returns a warning" do
|
155
|
+
expect(subject.message).to include "does not support"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
118
160
|
context "when a PactBroker::Client::Error is raised" do
|
119
161
|
before do
|
120
162
|
allow(matrix_client).to receive(:get).and_raise(PactBroker::Client::Error.new('error text'))
|
@@ -125,7 +167,7 @@ module PactBroker
|
|
125
167
|
end
|
126
168
|
|
127
169
|
it "returns a failure message" do
|
128
|
-
expect(subject.message).to
|
170
|
+
expect(subject.message).to include "error text"
|
129
171
|
end
|
130
172
|
end
|
131
173
|
|
@@ -37,7 +37,7 @@ module PactBroker
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "invokes the CanIDeploy service" do
|
40
|
-
expect(CanIDeploy).to receive(:call).with('http://pact-broker', version_selectors, {to_tag: nil, to_environment: nil, limit: 1000}, {output: 'table', retry_while_unknown: 1, retry_interval: 2}, {verbose: 'verbose'})
|
40
|
+
expect(CanIDeploy).to receive(:call).with('http://pact-broker', version_selectors, { to_tag: nil, to_environment: nil, limit: 1000, ignore_selectors: []}, {output: 'table', retry_while_unknown: 1, retry_interval: 2}, { pact_broker_base_url: 'http://pact-broker', verbose: 'verbose' })
|
41
41
|
invoke_can_i_deploy
|
42
42
|
end
|
43
43
|
|
@@ -55,7 +55,7 @@ module PactBroker
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it "passes the value as the matrix options" do
|
58
|
-
expect(CanIDeploy).to receive(:call).with(anything, anything, {to_tag: 'prod', to_environment: nil, limit: 1000}, anything, anything)
|
58
|
+
expect(CanIDeploy).to receive(:call).with(anything, anything, {to_tag: 'prod', to_environment: nil, limit: 1000, ignore_selectors: []}, anything, anything)
|
59
59
|
invoke_can_i_deploy
|
60
60
|
end
|
61
61
|
end
|
@@ -66,7 +66,7 @@ module PactBroker
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it "passes the value as the matrix options" do
|
69
|
-
expect(CanIDeploy).to receive(:call).with(anything, anything, {to_tag: nil, to_environment: 'prod', limit: 1000}, anything, anything)
|
69
|
+
expect(CanIDeploy).to receive(:call).with(anything, anything, {to_tag: nil, to_environment: 'prod', limit: 1000, ignore_selectors: []}, anything, anything)
|
70
70
|
invoke_can_i_deploy
|
71
71
|
end
|
72
72
|
end
|
@@ -78,7 +78,7 @@ module PactBroker
|
|
78
78
|
end
|
79
79
|
|
80
80
|
it "invokes the CanIDeploy service with the basic auth credentials" do
|
81
|
-
expect(CanIDeploy).to receive(:call).with(anything, anything, anything, anything, {basic_auth: {username: "foo", password: "bar"}, verbose: 'verbose'})
|
81
|
+
expect(CanIDeploy).to receive(:call).with(anything, anything, anything, anything, { pact_broker_base_url: 'http://pact-broker', basic_auth: {username: "foo", password: "bar"}, verbose: 'verbose'})
|
82
82
|
invoke_can_i_deploy
|
83
83
|
end
|
84
84
|
end
|
@@ -89,7 +89,7 @@ module PactBroker
|
|
89
89
|
end
|
90
90
|
|
91
91
|
it "invokes the CanIDeploy service with the basic auth credentials" do
|
92
|
-
expect(CanIDeploy).to receive(:call).with(anything, anything, anything, anything, {token: "some token", verbose: 'verbose'})
|
92
|
+
expect(CanIDeploy).to receive(:call).with(anything, anything, anything, anything, {pact_broker_base_url: 'http://pact-broker', token: "some token", verbose: 'verbose'})
|
93
93
|
invoke_can_i_deploy
|
94
94
|
end
|
95
95
|
end
|
@@ -6,11 +6,14 @@ module PactBroker::Client::CLI
|
|
6
6
|
describe Broker do
|
7
7
|
describe ".broker" do
|
8
8
|
before do
|
9
|
-
allow(PactBroker::Client::PublishPacts).to receive(:call).and_return(
|
9
|
+
allow(PactBroker::Client::PublishPacts).to receive(:call).and_return(result)
|
10
10
|
allow(PactBroker::Client::Git).to receive(:branch).and_return("bar")
|
11
11
|
subject.options = OpenStruct.new(minimum_valid_options)
|
12
|
+
allow($stdout).to receive(:puts)
|
12
13
|
end
|
13
14
|
|
15
|
+
let(:success) { true }
|
16
|
+
let(:result) { instance_double(PactBroker::Client::CommandResult, success: success, message: "message")}
|
14
17
|
let(:file_list) { ["spec/support/cli_test_pacts/foo.json"] }
|
15
18
|
let(:minimum_valid_options) do
|
16
19
|
{
|
@@ -28,7 +31,8 @@ module PactBroker::Client::CLI
|
|
28
31
|
"http://pact-broker",
|
29
32
|
["spec/support/cli_test_pacts/foo.json"],
|
30
33
|
{ number: "1.2.3", tags: [], version_required: false },
|
31
|
-
{
|
34
|
+
{},
|
35
|
+
{ pact_broker_base_url: 'http://pact-broker' }
|
32
36
|
)
|
33
37
|
invoke_broker
|
34
38
|
end
|
@@ -42,6 +46,7 @@ module PactBroker::Client::CLI
|
|
42
46
|
anything,
|
43
47
|
["spec/support/cli_test_pacts/bar.json", "spec/support/cli_test_pacts/foo.json"],
|
44
48
|
anything,
|
49
|
+
anything,
|
45
50
|
anything
|
46
51
|
)
|
47
52
|
invoke_broker
|
@@ -56,6 +61,7 @@ module PactBroker::Client::CLI
|
|
56
61
|
anything,
|
57
62
|
["spec/support/cli_test_pacts/bar.json", "spec/support/cli_test_pacts/foo.json"],
|
58
63
|
anything,
|
64
|
+
anything,
|
59
65
|
anything
|
60
66
|
)
|
61
67
|
invoke_broker
|
@@ -70,12 +76,29 @@ module PactBroker::Client::CLI
|
|
70
76
|
anything,
|
71
77
|
["spec/support/cli_test_pacts/bar.json", "spec/support/cli_test_pacts/foo.json"],
|
72
78
|
anything,
|
79
|
+
anything,
|
73
80
|
anything
|
74
81
|
)
|
75
82
|
invoke_broker
|
76
83
|
end
|
77
84
|
end
|
78
85
|
|
86
|
+
context "with an invalid argument specified that gets interpreted as a path" do
|
87
|
+
let(:file_list) { ['--wrong'] }
|
88
|
+
|
89
|
+
it "raises a more helpful error" do
|
90
|
+
expect{ invoke_broker }.to raise_error(Thor::Error, 'ERROR: pact-broker publish was called with invalid arguments ["--wrong"]')
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context "when a specified file does not exist" do
|
95
|
+
let(:file_list) { ['no-existy'] }
|
96
|
+
|
97
|
+
it "raises a more helpful error" do
|
98
|
+
expect{ invoke_broker }.to raise_error(Thor::Error, /Specified pact file 'no-existy' does not exist/)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
79
102
|
context "with a tag" do
|
80
103
|
before do
|
81
104
|
subject.options = OpenStruct.new(minimum_valid_options.merge(tag: ['foo']))
|
@@ -86,6 +109,7 @@ module PactBroker::Client::CLI
|
|
86
109
|
anything,
|
87
110
|
anything,
|
88
111
|
hash_including(tags: ['foo']),
|
112
|
+
anything,
|
89
113
|
anything
|
90
114
|
)
|
91
115
|
invoke_broker
|
@@ -109,6 +133,7 @@ module PactBroker::Client::CLI
|
|
109
133
|
anything,
|
110
134
|
anything,
|
111
135
|
hash_including(tags: ['foo', 'bar']),
|
136
|
+
anything,
|
112
137
|
anything
|
113
138
|
)
|
114
139
|
invoke_broker
|
@@ -127,6 +152,7 @@ module PactBroker::Client::CLI
|
|
127
152
|
anything,
|
128
153
|
anything,
|
129
154
|
hash_including(branch: "main", version_required: true),
|
155
|
+
anything,
|
130
156
|
anything
|
131
157
|
)
|
132
158
|
invoke_broker
|
@@ -151,6 +177,7 @@ module PactBroker::Client::CLI
|
|
151
177
|
anything,
|
152
178
|
anything,
|
153
179
|
hash_including(branch: "bar", version_required: false),
|
180
|
+
anything,
|
154
181
|
anything
|
155
182
|
)
|
156
183
|
invoke_broker
|
@@ -176,6 +203,7 @@ module PactBroker::Client::CLI
|
|
176
203
|
anything,
|
177
204
|
anything,
|
178
205
|
hash_including(branch: "bar", version_required: true),
|
206
|
+
anything,
|
179
207
|
anything
|
180
208
|
)
|
181
209
|
invoke_broker
|
@@ -193,6 +221,7 @@ module PactBroker::Client::CLI
|
|
193
221
|
anything,
|
194
222
|
anything,
|
195
223
|
hash_including(branch: "specified-branch", version_required: true),
|
224
|
+
anything,
|
196
225
|
anything
|
197
226
|
)
|
198
227
|
invoke_broker
|
@@ -212,6 +241,7 @@ module PactBroker::Client::CLI
|
|
212
241
|
anything,
|
213
242
|
anything,
|
214
243
|
hash_including(build_url: "http://ci"),
|
244
|
+
anything,
|
215
245
|
anything
|
216
246
|
)
|
217
247
|
invoke_broker
|
@@ -230,6 +260,7 @@ module PactBroker::Client::CLI
|
|
230
260
|
anything,
|
231
261
|
anything,
|
232
262
|
anything,
|
263
|
+
anything,
|
233
264
|
hash_including(basic_auth: { username: 'foo', password: 'bar' })
|
234
265
|
)
|
235
266
|
invoke_broker
|
@@ -267,12 +298,10 @@ module PactBroker::Client::CLI
|
|
267
298
|
end
|
268
299
|
|
269
300
|
context "when the publish command is not successful" do
|
270
|
-
|
271
|
-
allow(PactBroker::Client::PublishPacts).to receive(:call).and_return(false)
|
272
|
-
end
|
301
|
+
let(:success) { false }
|
273
302
|
|
274
|
-
it "raises a
|
275
|
-
expect { invoke_broker }.to raise_error
|
303
|
+
it "raises a SystemExit" do
|
304
|
+
expect { invoke_broker }.to raise_error SystemExit
|
276
305
|
end
|
277
306
|
end
|
278
307
|
end
|
@@ -66,7 +66,7 @@ module PactBroker
|
|
66
66
|
it "calls PactBroker::Client::Webhooks::Create with pact broker details" do
|
67
67
|
expect(PactBroker::Client::Webhooks::Create).to receive(:call) do | _, broker_base_url, pact_broker_client_options |
|
68
68
|
expect(broker_base_url).to eq "http://broker"
|
69
|
-
expect(pact_broker_client_options).to eq(basic_auth: { username: "username", password: "password"}, verbose: true)
|
69
|
+
expect(pact_broker_client_options).to eq(pact_broker_base_url: 'http://broker', basic_auth: { username: "username", password: "password"}, verbose: true)
|
70
70
|
command_result
|
71
71
|
end
|
72
72
|
subject
|
@@ -92,7 +92,7 @@ module PactBroker
|
|
92
92
|
|
93
93
|
it "calls Webhooks::Create without basic auth" do
|
94
94
|
expect(PactBroker::Client::Webhooks::Create).to receive(:call) do | _, _, pact_broker_client_options |
|
95
|
-
expect(pact_broker_client_options).to eq(verbose: true)
|
95
|
+
expect(pact_broker_client_options).to eq(verbose: true, pact_broker_base_url: 'http://broker')
|
96
96
|
command_result
|
97
97
|
end
|
98
98
|
subject
|
@@ -110,7 +110,7 @@ module PactBroker
|
|
110
110
|
it "calls Webhooks::Create without basic auth" do
|
111
111
|
|
112
112
|
expect(PactBroker::Client::Webhooks::Create).to receive(:call) do | _, _, pact_broker_client_options |
|
113
|
-
expect(pact_broker_client_options).to eq(verbose: true, token: "token")
|
113
|
+
expect(pact_broker_client_options).to eq(verbose: true, token: "token", pact_broker_base_url: 'http://broker')
|
114
114
|
command_result
|
115
115
|
end
|
116
116
|
subject
|