pact_broker 2.58.2 → 2.60.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/release_gem.yml +27 -7
- data/CHANGELOG.md +43 -0
- data/README.md +1 -1
- data/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema.rb +10 -3
- data/lib/pact_broker/api/decorators/version_decorator.rb +2 -0
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +26 -8
- data/lib/pact_broker/api/resources/all_webhooks.rb +9 -0
- data/lib/pact_broker/api/resources/badge.rb +4 -0
- data/lib/pact_broker/api/resources/can_i_deploy.rb +8 -0
- data/lib/pact_broker/api/resources/dashboard.rb +4 -0
- data/lib/pact_broker/api/resources/error_handler.rb +2 -4
- data/lib/pact_broker/api/resources/group.rb +8 -0
- data/lib/pact_broker/api/resources/index.rb +15 -8
- data/lib/pact_broker/api/resources/integration.rb +12 -0
- data/lib/pact_broker/api/resources/integrations.rb +9 -1
- data/lib/pact_broker/api/resources/label.rb +12 -5
- data/lib/pact_broker/api/resources/latest_pact.rb +6 -2
- data/lib/pact_broker/api/resources/latest_pacts.rb +9 -1
- data/lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb +8 -0
- data/lib/pact_broker/api/resources/pact.rb +5 -1
- data/lib/pact_broker/api/resources/pacticipant.rb +4 -0
- data/lib/pact_broker/api/resources/pacticipants.rb +14 -0
- data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +4 -1
- data/lib/pact_broker/api/resources/provider_pacts.rb +5 -1
- data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +3 -8
- data/lib/pact_broker/badges/service.rb +3 -2
- data/lib/pact_broker/configuration.rb +16 -4
- data/lib/pact_broker/doc/views/layouts/main.haml +1 -1
- data/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown +78 -0
- data/lib/pact_broker/domain/pact.rb +9 -0
- data/lib/pact_broker/groups/service.rb +1 -1
- data/lib/pact_broker/index/service.rb +6 -0
- data/lib/pact_broker/matrix/deployment_status_summary.rb +1 -1
- data/lib/pact_broker/pacts/content.rb +30 -5
- data/lib/pact_broker/pacts/repository.rb +25 -31
- data/lib/pact_broker/pacts/selector.rb +8 -0
- data/lib/pact_broker/policies.rb +2 -2
- data/lib/pact_broker/test/test_data_builder.rb +4 -4
- data/lib/pact_broker/ui/controllers/clusters.rb +1 -1
- data/lib/pact_broker/ui/controllers/groups.rb +2 -2
- data/lib/pact_broker/ui/controllers/index.rb +1 -1
- data/lib/pact_broker/ui/controllers/matrix.rb +2 -2
- data/lib/pact_broker/ui/views/groups/show.html.erb +3 -3
- data/lib/pact_broker/ui/views/index/show-with-tags.haml +10 -10
- data/lib/pact_broker/ui/views/index/show.haml +6 -6
- data/lib/pact_broker/ui/views/layouts/main.haml +1 -1
- data/lib/pact_broker/ui/views/matrix/show.haml +4 -5
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/job.rb +8 -2
- data/public/javascripts/pact.js +6 -2
- data/script/seed.rb +5 -7
- data/spec/features/get_provider_pacts_for_verification_spec.rb +0 -18
- data/spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_spec.rb +23 -4
- data/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb +4 -0
- data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +24 -6
- data/spec/lib/pact_broker/api/resources/error_handler_spec.rb +18 -1
- data/spec/lib/pact_broker/api/resources/provider_pacts_for_verification_spec.rb +8 -38
- data/spec/lib/pact_broker/badges/service_spec.rb +6 -6
- data/spec/lib/pact_broker/pacts/content_spec.rb +90 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_fallback_spec.rb +14 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +62 -0
- data/spec/lib/pact_broker/webhooks/job_spec.rb +19 -1
- data/spec/support/database_cleaner.rb +1 -5
- metadata +3 -5
- data/lib/pact_broker/api/contracts/verifiable_pacts_query_schema.rb +0 -36
- data/spec/lib/pact_broker/api/contracts/verifiable_pacts_query_schema_spec.rb +0 -97
@@ -53,7 +53,25 @@ module PactBroker
|
|
53
53
|
|
54
54
|
context "when an error occurs for the first time" do
|
55
55
|
before do
|
56
|
-
allow(PactBroker::Webhooks::Service).to receive(:execute_triggered_webhook_now).and_raise(
|
56
|
+
allow(PactBroker::Webhooks::Service).to receive(:execute_triggered_webhook_now).and_raise(error)
|
57
|
+
end
|
58
|
+
|
59
|
+
let(:error) { "an error" }
|
60
|
+
|
61
|
+
context "when the error is HTTP related (most likely caused by a problem with the webhook or request itself)" do
|
62
|
+
let(:error) { Errno::ECONNREFUSED.new }
|
63
|
+
|
64
|
+
it "logs a message at info" do
|
65
|
+
expect(logger).to receive(:info).with(/Error executing/, error)
|
66
|
+
subject
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "when the error is not HTTP related (most likely caused by a code, platform or environment issue)" do
|
71
|
+
it "logs a message at warn" do
|
72
|
+
expect(logger).to receive(:warn).with(/Error executing/, instance_of(RuntimeError))
|
73
|
+
subject
|
74
|
+
end
|
57
75
|
end
|
58
76
|
|
59
77
|
it "reschedules the job in 10 seconds" do
|
@@ -8,11 +8,7 @@ RSpec.configure do |config|
|
|
8
8
|
config.before(:suite) do
|
9
9
|
if defined?(::DB)
|
10
10
|
DatabaseCleaner.strategy = :transaction
|
11
|
-
|
12
|
-
DatabaseCleaner.clean_with :deletion
|
13
|
-
else
|
14
|
-
DatabaseCleaner.clean_with :truncation
|
15
|
-
end
|
11
|
+
PactBroker::Database.truncate
|
16
12
|
end
|
17
13
|
end
|
18
14
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact_broker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.60.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bethany Skurrie
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-09-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -581,7 +581,6 @@ files:
|
|
581
581
|
- lib/pact_broker/api/contracts/put_pact_params_contract.rb
|
582
582
|
- lib/pact_broker/api/contracts/request_validations.rb
|
583
583
|
- lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema.rb
|
584
|
-
- lib/pact_broker/api/contracts/verifiable_pacts_query_schema.rb
|
585
584
|
- lib/pact_broker/api/contracts/verification_contract.rb
|
586
585
|
- lib/pact_broker/api/contracts/webhook_contract.rb
|
587
586
|
- lib/pact_broker/api/decorators.rb
|
@@ -760,6 +759,7 @@ files:
|
|
760
759
|
- lib/pact_broker/doc/views/pact/tag-prod-version.markdown
|
761
760
|
- lib/pact_broker/doc/views/pact/tag-version.markdown
|
762
761
|
- lib/pact_broker/doc/views/pending-provider-pacts.markdown
|
762
|
+
- lib/pact_broker/doc/views/provider-pacts-for-verification.markdown
|
763
763
|
- lib/pact_broker/doc/views/provider.markdown
|
764
764
|
- lib/pact_broker/doc/views/version/latest-verification-results-where-pacticipant-is-consumer.markdown
|
765
765
|
- lib/pact_broker/doc/views/webhooks.markdown
|
@@ -1120,7 +1120,6 @@ files:
|
|
1120
1120
|
- spec/lib/pact/doc/markdown/index_renderer_spec.rb
|
1121
1121
|
- spec/lib/pact_broker/api/contracts/put_pact_params_contract_spec.rb
|
1122
1122
|
- spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_spec.rb
|
1123
|
-
- spec/lib/pact_broker/api/contracts/verifiable_pacts_query_schema_spec.rb
|
1124
1123
|
- spec/lib/pact_broker/api/contracts/verification_contract_spec.rb
|
1125
1124
|
- spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb
|
1126
1125
|
- spec/lib/pact_broker/api/decorators/dashboard_decorator_spec.rb
|
@@ -1506,7 +1505,6 @@ test_files:
|
|
1506
1505
|
- spec/lib/pact/doc/markdown/index_renderer_spec.rb
|
1507
1506
|
- spec/lib/pact_broker/api/contracts/put_pact_params_contract_spec.rb
|
1508
1507
|
- spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_spec.rb
|
1509
|
-
- spec/lib/pact_broker/api/contracts/verifiable_pacts_query_schema_spec.rb
|
1510
1508
|
- spec/lib/pact_broker/api/contracts/verification_contract_spec.rb
|
1511
1509
|
- spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb
|
1512
1510
|
- spec/lib/pact_broker/api/decorators/dashboard_decorator_spec.rb
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'dry-validation'
|
2
|
-
require 'pact_broker/api/contracts/dry_validation_workarounds'
|
3
|
-
require 'pact_broker/api/contracts/dry_validation_predicates'
|
4
|
-
|
5
|
-
module PactBroker
|
6
|
-
module Api
|
7
|
-
module Contracts
|
8
|
-
class VerifiablePactsQuerySchema
|
9
|
-
extend DryValidationWorkarounds
|
10
|
-
using PactBroker::HashRefinements
|
11
|
-
|
12
|
-
SCHEMA = Dry::Validation.Schema do
|
13
|
-
configure do
|
14
|
-
predicates(DryValidationPredicates)
|
15
|
-
config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__)
|
16
|
-
end
|
17
|
-
optional(:provider_version_tags).maybe(:array?)
|
18
|
-
optional(:consumer_version_selectors).each do
|
19
|
-
schema do
|
20
|
-
required(:tag).filled(:str?)
|
21
|
-
optional(:latest).filled(included_in?: ["true", "false"])
|
22
|
-
optional(:fallback_tag).filled(:str?)
|
23
|
-
optional(:consumer).filled(:str?, :not_blank?)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
optional(:include_pending_status).filled(included_in?: ["true", "false"])
|
27
|
-
optional(:include_wip_pacts_since).filled(:date?)
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.call(params)
|
31
|
-
select_first_message(flatten_indexed_messages(SCHEMA.call(params&.symbolize_keys).messages(full: true)))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
require 'pact_broker/api/contracts/verifiable_pacts_query_schema'
|
2
|
-
|
3
|
-
module PactBroker
|
4
|
-
module Api
|
5
|
-
module Contracts
|
6
|
-
describe VerifiablePactsQuerySchema do
|
7
|
-
let(:params) do
|
8
|
-
{
|
9
|
-
provider_version_tags: provider_version_tags,
|
10
|
-
consumer_version_selectors: consumer_version_selectors
|
11
|
-
}
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:provider_version_tags) { %w[master] }
|
15
|
-
|
16
|
-
let(:consumer_version_selectors) do
|
17
|
-
[{
|
18
|
-
tag: "master",
|
19
|
-
latest: "true"
|
20
|
-
}]
|
21
|
-
end
|
22
|
-
|
23
|
-
subject { VerifiablePactsQuerySchema.(params) }
|
24
|
-
|
25
|
-
context "when the params are valid" do
|
26
|
-
it "has no errors" do
|
27
|
-
expect(subject).to eq({})
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context "when provider_version_tags is not an array" do
|
32
|
-
let(:provider_version_tags) { "foo" }
|
33
|
-
|
34
|
-
it { is_expected.to have_key(:provider_version_tags) }
|
35
|
-
end
|
36
|
-
|
37
|
-
context "when the consumer_version_selector is missing a tag" do
|
38
|
-
let(:consumer_version_selectors) do
|
39
|
-
[{}]
|
40
|
-
end
|
41
|
-
|
42
|
-
it "flattens the messages" do
|
43
|
-
expect(subject[:consumer_version_selectors].first).to eq "tag is missing at index 0"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "when the consumer_version_selectors is missing the latest" do
|
48
|
-
let(:consumer_version_selectors) do
|
49
|
-
[{
|
50
|
-
tag: "master"
|
51
|
-
}]
|
52
|
-
end
|
53
|
-
|
54
|
-
it { is_expected.to be_empty }
|
55
|
-
end
|
56
|
-
|
57
|
-
context "when include_wip_pacts_since key exists" do
|
58
|
-
let(:include_wip_pacts_since) { nil }
|
59
|
-
let(:params) do
|
60
|
-
{
|
61
|
-
include_wip_pacts_since: include_wip_pacts_since
|
62
|
-
}
|
63
|
-
end
|
64
|
-
|
65
|
-
context "when it is nil" do
|
66
|
-
it { is_expected.to have_key(:include_wip_pacts_since) }
|
67
|
-
end
|
68
|
-
|
69
|
-
context "when it is not a date" do
|
70
|
-
let(:include_wip_pacts_since) { "foo" }
|
71
|
-
|
72
|
-
it { is_expected.to have_key(:include_wip_pacts_since) }
|
73
|
-
end
|
74
|
-
|
75
|
-
context "when it is a valid date" do
|
76
|
-
let(:include_wip_pacts_since) { "2013-02-13T20:04:45.000+11:00" }
|
77
|
-
|
78
|
-
it { is_expected.to_not have_key(:include_wip_pacts_since) }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context "when a blank consumer name is specified" do
|
83
|
-
let(:consumer_version_selectors) do
|
84
|
-
[{
|
85
|
-
tag: "feat-x",
|
86
|
-
consumer: ""
|
87
|
-
}]
|
88
|
-
end
|
89
|
-
|
90
|
-
it "has an error" do
|
91
|
-
expect(subject[:consumer_version_selectors].first).to include "blank"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|