pact_broker-client 1.40.0 → 1.45.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +21 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +57 -0
- data/Gemfile +4 -0
- data/README.md +39 -22
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +79 -280
- data/lib/pact_broker/client/backports.rb +9 -0
- data/lib/pact_broker/client/base_command.rb +98 -0
- data/lib/pact_broker/client/can_i_deploy.rb +57 -5
- data/lib/pact_broker/client/cli/broker.rb +23 -76
- data/lib/pact_broker/client/cli/custom_thor.rb +12 -0
- data/lib/pact_broker/client/cli/deployment_commands.rb +94 -0
- data/lib/pact_broker/client/cli/environment_commands.rb +70 -0
- data/lib/pact_broker/client/cli/pacticipant_commands.rb +53 -0
- data/lib/pact_broker/client/cli/record_deployment_long_desc.txt +0 -55
- 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/deployments.rb +4 -0
- data/lib/pact_broker/client/deployments/record_deployment.rb +38 -0
- data/lib/pact_broker/client/deployments/record_release.rb +99 -0
- data/lib/pact_broker/client/deployments/record_support_ended.rb +103 -0
- data/lib/pact_broker/client/deployments/record_undeployment.rb +127 -0
- data/lib/pact_broker/client/describe_text_formatter.rb +23 -0
- data/lib/pact_broker/client/environments.rb +6 -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 +26 -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 +31 -6
- data/lib/pact_broker/client/hal/http_client.rb +8 -2
- data/lib/pact_broker/client/hal/link.rb +8 -0
- data/lib/pact_broker/client/hal_client_methods.rb +1 -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/describe.rb +33 -0
- 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/publish_pacts.rb +6 -2
- data/lib/pact_broker/client/string_refinements.rb +56 -0
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/versions.rb +4 -1
- data/lib/pact_broker/client/versions/describe.rb +3 -1
- data/lib/pact_broker/client/versions/formatter.rb +3 -1
- data/lib/pact_broker/client/versions/json_formatter.rb +5 -3
- data/lib/pact_broker/client/versions/text_formatter.rb +3 -1
- data/pact-broker-client.gemspec +2 -0
- data/script/approve-all.sh +6 -0
- data/script/publish-pact.sh +12 -9
- data/script/record-deployments-and-releases.sh +18 -0
- data/spec/fixtures/approvals/can_i_deploy_failure_dry_run.approved.txt +7 -0
- data/spec/fixtures/approvals/can_i_deploy_ignore.approved.txt +13 -0
- data/spec/fixtures/approvals/can_i_deploy_success_dry_run.approved.txt +7 -0
- data/spec/fixtures/approvals/describe_environment.approved.txt +7 -0
- data/spec/fixtures/approvals/describe_pacticipant.approved.txt +2 -0
- data/spec/fixtures/approvals/list_environments.approved.txt +3 -0
- data/spec/integration/describe_environment_spec.rb +31 -0
- data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +109 -7
- data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +19 -6
- data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +1 -1
- 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/deployments/record_deployment_spec.rb +204 -0
- data/spec/lib/pact_broker/client/deployments/record_support_ended_spec.rb +208 -0
- data/spec/lib/pact_broker/client/deployments/record_undeployment_spec.rb +219 -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 +2 -2
- data/spec/pacts/pact_broker_client-pact_broker.json +88 -287
- 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_matrix_ignore_spec.rb +98 -0
- data/spec/service_providers/pact_broker_client_register_repository_spec.rb +2 -2
- data/spec/service_providers/pacticipants_create_spec.rb +5 -4
- data/spec/service_providers/publish_pacts_spec.rb +5 -2
- data/spec/service_providers/record_deployment_spec.rb +17 -36
- data/spec/service_providers/record_release_spec.rb +132 -0
- data/spec/service_providers/record_undeployment_spec.rb +166 -0
- data/spec/spec_helper.rb +15 -2
- data/spec/support/approvals.rb +26 -0
- data/spec/support/shared_context.rb +8 -3
- data/tasks/pact.rake +21 -1
- metadata +104 -7
- data/lib/pact_broker/client/versions/record_deployment.rb +0 -109
- data/lib/pact_broker/client/versions/record_undeployment.rb +0 -102
- data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +0 -82
@@ -0,0 +1,56 @@
|
|
1
|
+
module PactBroker
|
2
|
+
module Client
|
3
|
+
module StringRefinements
|
4
|
+
refine NilClass do
|
5
|
+
def blank?
|
6
|
+
true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
refine String do
|
11
|
+
def not_blank?
|
12
|
+
!blank?
|
13
|
+
end
|
14
|
+
|
15
|
+
def blank?
|
16
|
+
self.strip.size == 0
|
17
|
+
end
|
18
|
+
|
19
|
+
# ripped from rubyworks/facets, thank you
|
20
|
+
def snakecase
|
21
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
22
|
+
.gsub(/([a-z\d])([A-Z])/,'\1_\2')
|
23
|
+
.tr('-', '_')
|
24
|
+
.gsub(/\s/, '_')
|
25
|
+
.gsub(/__+/, '_')
|
26
|
+
.downcase
|
27
|
+
end
|
28
|
+
|
29
|
+
# ripped from rubyworks/facets, thank you
|
30
|
+
def camelcase(*separators)
|
31
|
+
case separators.first
|
32
|
+
when Symbol, TrueClass, FalseClass, NilClass
|
33
|
+
first_letter = separators.shift
|
34
|
+
end
|
35
|
+
|
36
|
+
separators = ['_', '\s'] if separators.empty?
|
37
|
+
|
38
|
+
str = self.dup
|
39
|
+
|
40
|
+
separators.each do |s|
|
41
|
+
str = str.gsub(/(?:#{s}+)([a-z])/){ $1.upcase }
|
42
|
+
end
|
43
|
+
|
44
|
+
case first_letter
|
45
|
+
when :upper, true
|
46
|
+
str = str.gsub(/(\A|\s)([a-z])/){ $1 + $2.upcase }
|
47
|
+
when :lower, false
|
48
|
+
str = str.gsub(/(\A|\s)([A-Z])/){ $1 + $2.downcase }
|
49
|
+
end
|
50
|
+
|
51
|
+
str
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -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(
|
8
|
-
JSON.pretty_generate(
|
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)
|
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,3 +1,6 @@
|
|
1
|
+
export PACT_BROKER_BASE_URL="http://localhost:9292"
|
2
|
+
export PACT_BROKER_TOKEN="localhost"
|
3
|
+
|
1
4
|
# bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
|
2
5
|
# --uuid d40f38c3-aaa3-47f5-9161-95c07bc16b14 \
|
3
6
|
# --request POST \
|
@@ -5,18 +8,18 @@
|
|
5
8
|
# --contract-published
|
6
9
|
|
7
10
|
bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
|
8
|
-
--uuid d40f38c3-aaa3-47f5-9161-
|
9
|
-
--
|
11
|
+
--uuid d40f38c3-aaa3-47f5-9161-95csfadfsd7 \
|
12
|
+
--description "This is quite a long description for a webhook that I hope will be truncated" \
|
10
13
|
--request POST \
|
11
14
|
--contract-published
|
12
15
|
|
13
|
-
bundle exec bin/pact-broker publish spec/pacts/pact_broker_client-pact_broker.json spec/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
20
23
|
|
21
24
|
# bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
|
22
25
|
# --uuid d40f38c3-aaa3-47f5-9161-95c07bc16555 \
|
@@ -0,0 +1,18 @@
|
|
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
|
+
|
9
|
+
bundle exec bin/pact-broker record-deployment --pacticipant Foo --version 2 --environment test
|
10
|
+
bundle exec bin/pact-broker record-deployment --pacticipant Foo --version 2 --environment test --target customer-1
|
11
|
+
bundle exec bin/pact-broker record-deployment --pacticipant Foo --version 2 --environment test --target customer-1
|
12
|
+
|
13
|
+
bundle exec bin/pact-broker record-undeployment --pacticipant Foo --environment test
|
14
|
+
bundle exec bin/pact-broker record-undeployment --pacticipant Foo --environment test
|
15
|
+
bundle exec bin/pact-broker record-undeployment --pacticipant Foo --environment test --target customer-1
|
16
|
+
|
17
|
+
bundle exec bin/pact-broker record-release --pacticipant Foo --version 2 --environment test
|
18
|
+
bundle exec bin/pact-broker record-support-ended --pacticipant Foo --version 2 --environment test
|
@@ -0,0 +1,7 @@
|
|
1
|
+
[33m[dry-run] [0mComputer says no ¯\_(ツ)_/¯ (but you're ignoring this by enabling dry run)
|
2
|
+
[33m[dry-run] [0m
|
3
|
+
[33m[dry-run] [0mtext matrix
|
4
|
+
[33m[dry-run] [0m
|
5
|
+
[33m[dry-run] [0msome reason
|
6
|
+
[33m[dry-run] [0m
|
7
|
+
[33m[dry-run] [0m[32mDry run enabled - ignoring any failures[0m
|
@@ -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,7 @@
|
|
1
|
+
[33m[dry-run] [0mComputer says yes \o/ (and maybe you don't need to enable dry run)
|
2
|
+
[33m[dry-run] [0m
|
3
|
+
[33m[dry-run] [0mtext matrix
|
4
|
+
[33m[dry-run] [0m
|
5
|
+
[33m[dry-run] [0msome reason
|
6
|
+
[33m[dry-run] [0m
|
7
|
+
[33m[dry-run] [0m[32mDry run enabled - ignoring any failures[0m
|
@@ -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
|
@@ -6,22 +6,28 @@ 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
|
+
let(:dry_run) { false }
|
11
12
|
let(:matrix_client) { instance_double('PactBroker::Client::Matrix') }
|
12
13
|
let(:matrix) do
|
13
14
|
instance_double('Matrix::Resource',
|
14
|
-
deployable?:
|
15
|
+
deployable?: deployable,
|
15
16
|
reason: 'some reason',
|
16
17
|
any_unknown?: any_unknown,
|
17
18
|
supports_unknown_count?: supports_unknown_count,
|
18
|
-
|
19
|
+
supports_ignore?: supports_ignore,
|
20
|
+
unknown_count: unknown_count,
|
21
|
+
notices: notices)
|
19
22
|
end
|
20
23
|
let(:unknown_count) { 0 }
|
21
24
|
let(:any_unknown) { unknown_count > 0 }
|
22
25
|
let(:supports_unknown_count) { true }
|
23
26
|
let(:retry_while_unknown) { 0 }
|
24
|
-
let(:options) { { output: 'text', retry_while_unknown: retry_while_unknown, retry_interval: 5 } }
|
27
|
+
let(:options) { { output: 'text', retry_while_unknown: retry_while_unknown, retry_interval: 5, dry_run: dry_run } }
|
28
|
+
let(:notices) { nil }
|
29
|
+
let(:supports_ignore) { true }
|
30
|
+
let(:deployable) { true }
|
25
31
|
|
26
32
|
|
27
33
|
before do
|
@@ -55,10 +61,27 @@ module PactBroker
|
|
55
61
|
it "returns a success reason" do
|
56
62
|
expect(subject.message).to include "some reason"
|
57
63
|
end
|
64
|
+
|
65
|
+
context "when there are notices" do
|
66
|
+
let(:notices) { [Notice.new(text: "some notice", type: "info")] }
|
67
|
+
|
68
|
+
it "returns the notices instead of the reason" do
|
69
|
+
expect(subject.message).to_not include "some reason"
|
70
|
+
expect(subject.message).to include "some notice"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "when dry_run is enabled" do
|
75
|
+
let(:dry_run) { true }
|
76
|
+
|
77
|
+
it "prefixes each line with [dry-run]" do
|
78
|
+
Approvals.verify(subject.message, :name => "can_i_deploy_success_dry_run", format: :txt)
|
79
|
+
end
|
80
|
+
end
|
58
81
|
end
|
59
82
|
|
60
83
|
context "when the versions are not deployable" do
|
61
|
-
let(:matrix) { instance_double('Matrix::Resource', deployable?: false, reason: 'some reason', any_unknown?: false) }
|
84
|
+
let(:matrix) { instance_double('Matrix::Resource', deployable?: false, reason: 'some reason', any_unknown?: false, notices: notices) }
|
62
85
|
|
63
86
|
it "returns a failure response" do
|
64
87
|
expect(subject.success).to be false
|
@@ -71,6 +94,27 @@ module PactBroker
|
|
71
94
|
it "returns a failure reason" do
|
72
95
|
expect(subject.message).to include "some reason"
|
73
96
|
end
|
97
|
+
|
98
|
+
context "when there are notices" do
|
99
|
+
let(:notices) { [Notice.new(text: "some notice", type: "info")] }
|
100
|
+
|
101
|
+
it "returns the notices instead of the reason" do
|
102
|
+
expect(subject.message).to_not include "some reason"
|
103
|
+
expect(subject.message).to include "some notice"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
context "when dry_run is enabled" do
|
108
|
+
let(:dry_run) { true }
|
109
|
+
|
110
|
+
it "returns a success response" do
|
111
|
+
expect(subject.success).to be true
|
112
|
+
end
|
113
|
+
|
114
|
+
it "prefixes each line with [dry-run]" do
|
115
|
+
Approvals.verify(subject.message, :name => "can_i_deploy_failure_dry_run", format: :txt)
|
116
|
+
end
|
117
|
+
end
|
74
118
|
end
|
75
119
|
|
76
120
|
context "when retry_while_unknown is greater than 0" do
|
@@ -112,6 +156,38 @@ module PactBroker
|
|
112
156
|
it "returns a failure message" do
|
113
157
|
expect(subject.message).to match /does not provide a count/
|
114
158
|
end
|
159
|
+
|
160
|
+
context "when dry_run is enabled" do
|
161
|
+
let(:dry_run) { true }
|
162
|
+
|
163
|
+
it "returns a success response" do
|
164
|
+
expect(subject.success).to be true
|
165
|
+
end
|
166
|
+
|
167
|
+
it "returns a failure message" do
|
168
|
+
expect(subject.message).to include "[dry-run]"
|
169
|
+
expect(subject.message).to match /does not provide a count/
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
context "when there are ignore selectors but the matrix does not support ignoring" do
|
176
|
+
let(:matrix_options) { { ignore_selectors: [{ pacticipant_name: "Foo" }]} }
|
177
|
+
let(:supports_ignore) { false }
|
178
|
+
|
179
|
+
context "when deployable" do
|
180
|
+
it "returns a warning" do
|
181
|
+
expect(subject.message).to include "does not support"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
context "when not deployable" do
|
186
|
+
let(:deployable) { false }
|
187
|
+
|
188
|
+
it "returns a warning" do
|
189
|
+
expect(subject.message).to include "does not support"
|
190
|
+
end
|
115
191
|
end
|
116
192
|
end
|
117
193
|
|
@@ -125,7 +201,20 @@ module PactBroker
|
|
125
201
|
end
|
126
202
|
|
127
203
|
it "returns a failure message" do
|
128
|
-
expect(subject.message).to
|
204
|
+
expect(subject.message).to include "error text"
|
205
|
+
end
|
206
|
+
|
207
|
+
context "when dry_run is enabled" do
|
208
|
+
let(:dry_run) { true }
|
209
|
+
|
210
|
+
it "returns a success response" do
|
211
|
+
expect(subject.success).to be true
|
212
|
+
end
|
213
|
+
|
214
|
+
it "returns a failure message" do
|
215
|
+
expect(subject.message).to include "[dry-run]"
|
216
|
+
expect(subject.message).to match /error text/
|
217
|
+
end
|
129
218
|
end
|
130
219
|
end
|
131
220
|
|
@@ -141,7 +230,20 @@ module PactBroker
|
|
141
230
|
end
|
142
231
|
|
143
232
|
it "returns a failure message and backtrace" do
|
144
|
-
expect(subject.message).to include "Error retrieving matrix. StandardError - error text
|
233
|
+
expect(subject.message).to include "Error retrieving matrix. StandardError - error text"
|
234
|
+
end
|
235
|
+
|
236
|
+
context "when dry_run is enabled" do
|
237
|
+
let(:dry_run) { true }
|
238
|
+
|
239
|
+
it "returns a success response" do
|
240
|
+
expect(subject.success).to be true
|
241
|
+
end
|
242
|
+
|
243
|
+
it "returns a failure message" do
|
244
|
+
expect(subject.message).to include "[dry-run]"
|
245
|
+
expect(subject.message).to match /error text/
|
246
|
+
end
|
145
247
|
end
|
146
248
|
end
|
147
249
|
end
|