pact_broker 2.59.1 → 2.59.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/pact_broker/api/resources/error_handler.rb +2 -4
- data/lib/pact_broker/configuration.rb +10 -1
- data/lib/pact_broker/matrix/deployment_status_summary.rb +1 -1
- data/lib/pact_broker/pacts/content.rb +2 -1
- data/lib/pact_broker/version.rb +1 -1
- data/spec/lib/pact_broker/api/resources/error_handler_spec.rb +18 -1
- data/spec/lib/pact_broker/pacts/content_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1933f8f7902c43ed7d9db7c022a66f2569c6301dec2c8ac767e1da7b05f70b5
|
4
|
+
data.tar.gz: 40d82183c3a94b2bfc2bfa37a9aee12cc27729e1c3a1b3191df980c2ba3ad192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5078b560d3d0abe897572f35276b3aec1c6752026ba849a9b61517def382ea0d936731a6b2f59801b0101cab7bde636ef3e9e5e7afe9524e13c3def552f48ded
|
7
|
+
data.tar.gz: 6fc016ea9e10bcbad4f78d60b93a81b5d0aab2ffbfef9d222a094e0348f632680995bce488abe9fefe55cad745afafef323ce3c972db3e78a7e1f6759d222f6e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
<a name="v2.59.2"></a>
|
2
|
+
### v2.59.2 (2020-08-06)
|
3
|
+
|
4
|
+
#### Bug Fixes
|
5
|
+
|
6
|
+
* gracefully handle contracts without interactions or messages in deployment status warnings ([6c223e69](/../../commit/6c223e69))
|
7
|
+
* add missing info level log for business level errors ([80a895bf](/../../commit/80a895bf))
|
8
|
+
|
1
9
|
<a name="v2.59.1"></a>
|
2
10
|
### v2.59.1 (2020-08-04)
|
3
11
|
|
@@ -5,11 +5,8 @@ module PactBroker
|
|
5
5
|
module Api
|
6
6
|
module Resources
|
7
7
|
class ErrorHandler
|
8
|
-
|
9
8
|
include PactBroker::Logging
|
10
9
|
|
11
|
-
WARNING_ERROR_CLASSES = [Sequel::ForeignKeyConstraintViolation]
|
12
|
-
|
13
10
|
def self.call e, request, response
|
14
11
|
error_reference = generate_error_reference
|
15
12
|
if log_as_warning?(e)
|
@@ -17,6 +14,7 @@ module PactBroker
|
|
17
14
|
elsif reportable?(e)
|
18
15
|
log_error(e, "Error reference #{error_reference}")
|
19
16
|
report(e, error_reference, request)
|
17
|
+
else
|
20
18
|
logger.info("Error reference #{error_reference}", e)
|
21
19
|
end
|
22
20
|
response.body = response_body_hash(e, error_reference).to_json
|
@@ -31,7 +29,7 @@ module PactBroker
|
|
31
29
|
end
|
32
30
|
|
33
31
|
def self.log_as_warning?(e)
|
34
|
-
|
32
|
+
PactBroker.configuration.warning_error_classes.any? { |clazz| e.is_a?(clazz) }
|
35
33
|
end
|
36
34
|
|
37
35
|
def self.display_message(e, error_reference)
|
@@ -31,12 +31,14 @@ module PactBroker
|
|
31
31
|
:webhook_host_whitelist,
|
32
32
|
:base_equality_only_on_content_that_affects_verification_results,
|
33
33
|
:seed_example_data,
|
34
|
-
:badge_provider_mode
|
34
|
+
:badge_provider_mode,
|
35
|
+
:warning_error_class_names
|
35
36
|
]
|
36
37
|
|
37
38
|
attr_accessor :base_url, :log_dir, :database_connection, :auto_migrate_db, :auto_migrate_db_data, :allow_missing_migration_files, :example_data_seeder, :seed_example_data, :use_hal_browser, :html_pact_renderer, :use_rack_protection
|
38
39
|
attr_accessor :validate_database_connection_config, :enable_diagnostic_endpoints, :version_parser, :sha_generator
|
39
40
|
attr_accessor :use_case_sensitive_resource_names, :order_versions_by_date
|
41
|
+
attr_accessor :warning_error_class_names
|
40
42
|
attr_accessor :check_for_potential_duplicate_pacticipant_names
|
41
43
|
attr_accessor :webhook_retry_schedule
|
42
44
|
attr_reader :webhook_http_method_whitelist, :webhook_scheme_whitelist, :webhook_host_whitelist
|
@@ -115,6 +117,7 @@ module PactBroker
|
|
115
117
|
require 'pact_broker/api/resources/default_base_resource'
|
116
118
|
PactBroker::Api::Resources::DefaultBaseResource
|
117
119
|
}
|
120
|
+
config.warning_error_class_names = ['Sequel::ForeignKeyConstraintViolation']
|
118
121
|
config
|
119
122
|
end
|
120
123
|
|
@@ -228,6 +231,12 @@ module PactBroker
|
|
228
231
|
@webhook_host_whitelist = parse_space_delimited_string_list_property('webhook_host_whitelist', webhook_host_whitelist)
|
229
232
|
end
|
230
233
|
|
234
|
+
def warning_error_classes
|
235
|
+
warning_error_class_names.collect do | class_name |
|
236
|
+
Object.const_get(class_name)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
231
240
|
private
|
232
241
|
|
233
242
|
def parse_space_delimited_string_list_property property_name, property_value
|
@@ -195,7 +195,7 @@ module PactBroker
|
|
195
195
|
InteractionsMissingVerifications.new(selector_for(row.consumer_name), selector_for(row.provider_name), row.verification.interactions_missing_test_results)
|
196
196
|
end
|
197
197
|
rescue StandardError => e
|
198
|
-
|
198
|
+
logger.warn("Error determining if there were missing interaction verifications", e)
|
199
199
|
nil
|
200
200
|
end
|
201
201
|
end.compact.tap { |it| report_missing_interaction_verifications(it) if it.any? }
|
data/lib/pact_broker/version.rb
CHANGED
@@ -5,7 +5,6 @@ module PactBroker
|
|
5
5
|
module Resources
|
6
6
|
describe ErrorHandler do
|
7
7
|
describe "call" do
|
8
|
-
|
9
8
|
before do
|
10
9
|
allow(ErrorHandler).to receive(:logger).and_return(logger)
|
11
10
|
allow(SecureRandom).to receive(:urlsafe_base64).and_return("bYWfn-+yWPlf")
|
@@ -45,6 +44,24 @@ module PactBroker
|
|
45
44
|
subject
|
46
45
|
end
|
47
46
|
|
47
|
+
context "when the error class is in the warning_error_classes list" do
|
48
|
+
let(:error) { Sequel::ForeignKeyConstraintViolation.new }
|
49
|
+
|
50
|
+
it "logs at warn so as not to wake everyone up in the middle of the night" do
|
51
|
+
expect(logger).to receive(:warn).with(/bYWfnyWPlf/, error)
|
52
|
+
subject
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the error is not reportable and not a warning level" do
|
57
|
+
let(:error) { PactBroker::Error.new('foo') }
|
58
|
+
|
59
|
+
it "logs at info" do
|
60
|
+
expect(logger).to receive(:info).with(/bYWfnyWPlf/, error)
|
61
|
+
subject
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
48
65
|
context "when show_backtrace_in_error_response? is true" do
|
49
66
|
before do
|
50
67
|
allow(PactBroker.configuration).to receive(:show_backtrace_in_error_response?).and_return(true)
|
@@ -308,6 +308,14 @@ module PactBroker
|
|
308
308
|
expect(subject.interactions_missing_test_results.count).to eq 1
|
309
309
|
end
|
310
310
|
|
311
|
+
context "with no interactions" do
|
312
|
+
let(:pact_content) { {} }
|
313
|
+
|
314
|
+
it "does not blow up" do
|
315
|
+
expect(subject.interactions_missing_test_results.count).to eq 0
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
311
319
|
context "with nil test results" do
|
312
320
|
let(:test_results) { nil }
|
313
321
|
|
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.59.
|
4
|
+
version: 2.59.2
|
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-08-
|
13
|
+
date: 2020-08-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|