pact_broker 2.72.0 → 2.73.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 +1 -1
- data/CHANGELOG.md +19 -0
- data/lib/db.rb +1 -0
- data/lib/pact_broker/api/decorators/extended_pact_decorator.rb +9 -1
- data/lib/pact_broker/api/decorators/extended_verification_decorator.rb +8 -0
- data/lib/pact_broker/api/decorators/matrix_decorator.rb +9 -4
- data/lib/pact_broker/api/decorators/tag_decorator.rb +0 -3
- data/lib/pact_broker/api/pact_broker_urls.rb +1 -1
- data/lib/pact_broker/api/resources/error_handler.rb +1 -1
- data/lib/pact_broker/app.rb +1 -0
- data/lib/pact_broker/configuration.rb +12 -4
- data/lib/pact_broker/metrics/service.rb +12 -1
- data/lib/pact_broker/pacts/metadata.rb +1 -3
- data/lib/pact_broker/tags/tag_with_latest_flag.rb +2 -0
- data/lib/pact_broker/test/http_test_data_builder.rb +1 -1
- data/lib/pact_broker/version.rb +1 -1
- data/lib/sequel/extensions/statement_timeout.rb +22 -0
- data/script/reproduce-issue-starting-up.rb +43 -0
- data/script/reproduce-issue.rb +2 -22
- data/spec/lib/pact_broker/api/decorators/extended_pact_decorator_spec.rb +1 -0
- data/spec/lib/pact_broker/api/decorators/matrix_decorator_spec.rb +20 -8
- data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +8 -0
- data/spec/lib/pact_broker/api/resources/error_handler_spec.rb +16 -0
- data/spec/lib/pact_broker/pacts/selected_pact_spec.rb +23 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bc95def65b82d8d938fa3b245bb6f306092d8d00572778f8b3f8ae377479fd0
|
4
|
+
data.tar.gz: 2790ca52a1db8ba01ca02ef24b6816482a4fdf38a925e8eb737d998ff2ff1213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d2740784d48edea10528d9b3a1db0ec6f89d5474c2b7b3c4c4077a7b1d57c714f7f902066e7e76cf921ab5b51e8cc58b6d3146a2a752c3535394c87e7457831
|
7
|
+
data.tar.gz: 5fb6688a830ecd05bf7eb8985d651f0a406a5bfe348e29287b93328bb2cf9f36013fda31394e3499ee058c10e54c326366f59567dc3d5eadf02507d9512787f6
|
data/.github/workflows/test.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
<a name="v2.73.0"></a>
|
2
|
+
### v2.73.0 (2020-12-16)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* **wip**
|
7
|
+
* permenently enable feature that keeps pacts as WIP when verified via the URL from a webhook triggered by pact publication ([70071373](/../../commit/70071373))
|
8
|
+
|
9
|
+
* allow error causes to be configured to log at warning level ([3a7bf5ea](/../../commit/3a7bf5ea))
|
10
|
+
* add self relations for tags in matrix resource ([727cee99](/../../commit/727cee99))
|
11
|
+
* add self relation to tags in extended pact and verification resources ([a560ce6d](/../../commit/a560ce6d))
|
12
|
+
|
13
|
+
* **metrics**
|
14
|
+
* timeout matrix count ([43091b57](/../../commit/43091b57))
|
15
|
+
|
16
|
+
#### Bug Fixes
|
17
|
+
|
18
|
+
* url encode tag name in tag URL ([80df832d](/../../commit/80df832d))
|
19
|
+
|
1
20
|
<a name="v2.72.0"></a>
|
2
21
|
### v2.72.0 (2020-12-02)
|
3
22
|
|
data/lib/db.rb
CHANGED
@@ -33,6 +33,7 @@ module DB
|
|
33
33
|
con = Sequel.connect(db_credentials.merge(:logger => logger, :pool_class => Sequel::ThreadedConnectionPool, :encoding => 'utf8'))
|
34
34
|
con.extension(:connection_validator)
|
35
35
|
con.extension(:pagination)
|
36
|
+
con.extension(:statement_timeout)
|
36
37
|
con.extend_datasets do
|
37
38
|
def any?
|
38
39
|
!empty?
|
@@ -11,6 +11,14 @@ module PactBroker
|
|
11
11
|
property :name
|
12
12
|
property :latest, getter: ->(_) { true }
|
13
13
|
|
14
|
+
link :self do | options |
|
15
|
+
{
|
16
|
+
title: 'Tag',
|
17
|
+
name: represented.name,
|
18
|
+
href: tag_url(options[:base_url], represented)
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
14
22
|
link "pb:latest-pact" do | opts |
|
15
23
|
{
|
16
24
|
name: "The latest pact with the tag #{represented.name}",
|
@@ -33,7 +41,7 @@ module PactBroker
|
|
33
41
|
|
34
42
|
def head_tags
|
35
43
|
represented.head_tag_names.collect do | tag_name |
|
36
|
-
OpenStruct.new(name: tag_name, pact: represented)
|
44
|
+
OpenStruct.new(name: tag_name, pact: represented, version: represented.consumer_version)
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
@@ -7,6 +7,14 @@ module PactBroker
|
|
7
7
|
class TagDecorator < BaseDecorator
|
8
8
|
property :name
|
9
9
|
property :latest?, as: :latest
|
10
|
+
|
11
|
+
link :self do | options |
|
12
|
+
{
|
13
|
+
title: 'Tag',
|
14
|
+
name: represented.name,
|
15
|
+
href: tag_url(options[:base_url], represented)
|
16
|
+
}
|
17
|
+
end
|
10
18
|
end
|
11
19
|
|
12
20
|
collection :provider_version_tags, as: :tags, embedded: true, extend: TagDecorator
|
@@ -76,7 +76,7 @@ module PactBroker
|
|
76
76
|
href: version_url(base_url, consumer_version)
|
77
77
|
}
|
78
78
|
},
|
79
|
-
tags: tags(line.consumer_version_tags)
|
79
|
+
tags: tags(line.consumer_version_tags, base_url)
|
80
80
|
},
|
81
81
|
_links: {
|
82
82
|
self: {
|
@@ -86,11 +86,16 @@ module PactBroker
|
|
86
86
|
}
|
87
87
|
end
|
88
88
|
|
89
|
-
def tags(tags)
|
89
|
+
def tags(tags, base_url)
|
90
90
|
tags.collect do | tag |
|
91
91
|
{
|
92
92
|
name: tag.name,
|
93
|
-
latest: tag.latest
|
93
|
+
latest: tag.latest?,
|
94
|
+
_links: {
|
95
|
+
self: {
|
96
|
+
href: tag_url(base_url, tag)
|
97
|
+
}
|
98
|
+
}
|
94
99
|
}
|
95
100
|
end
|
96
101
|
end
|
@@ -114,7 +119,7 @@ module PactBroker
|
|
114
119
|
href: version_url(base_url, provider_version)
|
115
120
|
}
|
116
121
|
},
|
117
|
-
tags: tags(line.provider_version_tags)
|
122
|
+
tags: tags(line.provider_version_tags, base_url)
|
118
123
|
}
|
119
124
|
end
|
120
125
|
|
@@ -201,7 +201,7 @@ module PactBroker
|
|
201
201
|
end
|
202
202
|
|
203
203
|
def tag_url base_url, tag
|
204
|
-
"#{tags_url(base_url, tag.version)}/#{tag.name}"
|
204
|
+
"#{tags_url(base_url, tag.version)}/#{url_encode(tag.name)}"
|
205
205
|
end
|
206
206
|
|
207
207
|
def templated_tag_url_for_pacticipant pacticipant_name, base_url = ""
|
@@ -29,7 +29,7 @@ module PactBroker
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.log_as_warning?(e)
|
32
|
-
PactBroker.configuration.warning_error_classes.any? { |clazz| e.is_a?(clazz) }
|
32
|
+
PactBroker.configuration.warning_error_classes.any? { |clazz| e.is_a?(clazz) || e.cause&.is_a?(clazz) }
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.display_message(e, obfuscated_message)
|
data/lib/pact_broker/app.rb
CHANGED
@@ -126,6 +126,7 @@ module PactBroker
|
|
126
126
|
PactBroker::DB.validate_connection_config if configuration.validate_database_connection_config
|
127
127
|
PactBroker::DB.set_mysql_strict_mode_if_mysql
|
128
128
|
PactBroker::DB.connection.extension(:pagination)
|
129
|
+
PactBroker::DB.connection.extension(:statement_timeout)
|
129
130
|
|
130
131
|
Sequel.datetime_class = DateTime
|
131
132
|
Sequel.database_timezone = :utc # Store all dates in UTC, assume any date without a TZ is UTC
|
@@ -38,7 +38,8 @@ module PactBroker
|
|
38
38
|
:log_dir,
|
39
39
|
:allow_missing_migration_files,
|
40
40
|
:auto_migrate_db_data,
|
41
|
-
:use_rack_protection
|
41
|
+
:use_rack_protection,
|
42
|
+
:metrics_sql_statement_timeout
|
42
43
|
]
|
43
44
|
|
44
45
|
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
|
@@ -57,6 +58,7 @@ module PactBroker
|
|
57
58
|
attr_reader :api_error_reporters
|
58
59
|
attr_reader :custom_logger
|
59
60
|
attr_accessor :policy_builder, :policy_scope_builder, :base_resource_class_factory
|
61
|
+
attr_accessor :metrics_sql_statement_timeout
|
60
62
|
|
61
63
|
alias_method :policy_finder=, :policy_builder=
|
62
64
|
alias_method :policy_scope_finder=, :policy_scope_builder=
|
@@ -125,7 +127,8 @@ module PactBroker
|
|
125
127
|
require 'pact_broker/api/resources/default_base_resource'
|
126
128
|
PactBroker::Api::Resources::DefaultBaseResource
|
127
129
|
}
|
128
|
-
config.warning_error_class_names = ['Sequel::ForeignKeyConstraintViolation']
|
130
|
+
config.warning_error_class_names = ['Sequel::ForeignKeyConstraintViolation', 'PG::QueryCanceled']
|
131
|
+
config.metrics_sql_statement_timeout = 30
|
129
132
|
config
|
130
133
|
end
|
131
134
|
|
@@ -247,8 +250,13 @@ module PactBroker
|
|
247
250
|
|
248
251
|
def warning_error_classes
|
249
252
|
warning_error_class_names.collect do | class_name |
|
250
|
-
|
251
|
-
|
253
|
+
begin
|
254
|
+
Object.const_get(class_name)
|
255
|
+
rescue NameError => e
|
256
|
+
logger.warn("Class #{class_name} couldn't be loaded as a warning error class (#{e.class} - #{e.message}). Ignoring.")
|
257
|
+
nil
|
258
|
+
end
|
259
|
+
end.compact
|
252
260
|
end
|
253
261
|
|
254
262
|
private
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'pact_broker/configuration'
|
1
2
|
require 'pact_broker/pacts/pact_publication'
|
2
3
|
require 'pact_broker/pacts/pact_version'
|
3
4
|
require 'pact_broker/domain/pacticipant'
|
@@ -66,7 +67,7 @@ module PactBroker
|
|
66
67
|
count: PactBroker::Webhooks::Execution.count
|
67
68
|
},
|
68
69
|
matrix: {
|
69
|
-
count:
|
70
|
+
count: matrix_count
|
70
71
|
}
|
71
72
|
}
|
72
73
|
end
|
@@ -87,6 +88,16 @@ module PactBroker
|
|
87
88
|
order by 1"
|
88
89
|
PactBroker::Pacts::PactPublication.db[query].all.each_with_object({}) { |row, hash| hash[row[:number_of_verifications]] = row[:pact_version_count] }
|
89
90
|
end
|
91
|
+
|
92
|
+
def matrix_count
|
93
|
+
begin
|
94
|
+
PactBroker::Matrix::Row.db.with_statement_timeout(PactBroker.configuration.metrics_sql_statement_timeout) do
|
95
|
+
PactBroker::Matrix::Row.count
|
96
|
+
end
|
97
|
+
rescue Sequel::DatabaseError => e
|
98
|
+
-1
|
99
|
+
end
|
100
|
+
end
|
90
101
|
end
|
91
102
|
end
|
92
103
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'pact_broker/feature_toggle'
|
2
|
-
|
3
1
|
module PactBroker
|
4
2
|
module Pacts
|
5
3
|
module Metadata
|
@@ -33,7 +31,7 @@ module PactBroker
|
|
33
31
|
consumer_version_number: pact.consumer_version_number,
|
34
32
|
consumer_version_tags: pact.consumer_version_tag_names
|
35
33
|
}
|
36
|
-
metadata[:wip] = "true"
|
34
|
+
metadata[:wip] = "true"
|
37
35
|
metadata
|
38
36
|
end
|
39
37
|
end
|
@@ -5,6 +5,8 @@ module PactBroker
|
|
5
5
|
module Tags
|
6
6
|
# The tag associated with the latest verification for a given tag
|
7
7
|
class TagWithLatestFlag < Sequel::Model(:tags_with_latest_flag)
|
8
|
+
associate(:many_to_one, :version, :class => "PactBroker::Domain::Version", :key => :version_id, :primary_key => :id)
|
9
|
+
|
8
10
|
dataset_module do
|
9
11
|
include PactBroker::Repositories::Helpers
|
10
12
|
end
|
@@ -77,7 +77,7 @@ module PactBroker
|
|
77
77
|
consumerVersionSelectors: consumer_version_selectors,
|
78
78
|
includePendingStatus: enable_pending,
|
79
79
|
includeWipPactsSince: include_wip_pacts_since
|
80
|
-
}
|
80
|
+
}.compact
|
81
81
|
puts body.to_yaml
|
82
82
|
puts ""
|
83
83
|
@pacts_for_verification_response = client.post("/pacts/provider/#{encode(provider)}/for-verification", body)
|
data/lib/pact_broker/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Sequel
|
2
|
+
module StatementTimeout
|
3
|
+
def with_statement_timeout(timeout_seconds = 20)
|
4
|
+
# Might not have postgres class loaded, use class name
|
5
|
+
if self.class.name == "Sequel::Postgres::Database"
|
6
|
+
# Don't want to use a transaction because this will often be a read and a transaction is unnecessary.
|
7
|
+
# Also, when using it for clean, want to control the transactions outside this.
|
8
|
+
current_statement_timeout = execute("show statement_timeout") { |r| r.first.values.first }
|
9
|
+
run("SET statement_timeout = '#{timeout_seconds}s'")
|
10
|
+
begin
|
11
|
+
yield
|
12
|
+
ensure
|
13
|
+
run("SET statement_timeout = '#{current_statement_timeout}'")
|
14
|
+
end
|
15
|
+
else
|
16
|
+
yield
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Database.register_extension(:statement_timeout){|db| db.extend(StatementTimeout) }
|
22
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH << "#{Dir.pwd}/lib"
|
4
|
+
|
5
|
+
begin
|
6
|
+
|
7
|
+
require 'pact_broker/test/http_test_data_builder'
|
8
|
+
base_url = ENV['PACT_BROKER_BASE_URL'] || 'http://localhost:9292'
|
9
|
+
|
10
|
+
td = PactBroker::Test::HttpTestDataBuilder.new(base_url, { })
|
11
|
+
td.delete_integration(consumer: "MyConsumer", provider: "MyProvider")
|
12
|
+
.can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod")
|
13
|
+
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
|
14
|
+
.publish_pact(consumer: "MyConsumer", consumer_version: "1", provider: "MyProvider", content_id: "111", tag: "feature/a")
|
15
|
+
.can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod")
|
16
|
+
.get_pacts_for_verification(
|
17
|
+
enable_pending: true,
|
18
|
+
provider_version_tag: "main",
|
19
|
+
include_wip_pacts_since: "2020-01-01",
|
20
|
+
consumer_version_selectors: [{ tag: "main", latest: true }])
|
21
|
+
.verify_pact(
|
22
|
+
index: 0,
|
23
|
+
provider_version_tag: "main",
|
24
|
+
provider_version: "1",
|
25
|
+
success: false
|
26
|
+
)
|
27
|
+
.get_pacts_for_verification(
|
28
|
+
enable_pending: true,
|
29
|
+
provider_version_tag: "main",
|
30
|
+
include_wip_pacts_since: "2020-01-01",
|
31
|
+
consumer_version_selectors: [{ tag: "main", latest: true }])
|
32
|
+
.can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod")
|
33
|
+
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
|
34
|
+
.deploy_to_prod(pacticipant: "MyProvider", version: "1")
|
35
|
+
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
|
36
|
+
.deploy_to_prod(pacticipant: "MyConsumer", version: "1")
|
37
|
+
|
38
|
+
rescue StandardError => e
|
39
|
+
puts "#{e.class} #{e.message}"
|
40
|
+
puts e.backtrace
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
|
data/script/reproduce-issue.rb
CHANGED
@@ -9,31 +9,11 @@ begin
|
|
9
9
|
|
10
10
|
td = PactBroker::Test::HttpTestDataBuilder.new(base_url, { })
|
11
11
|
td.delete_integration(consumer: "MyConsumer", provider: "MyProvider")
|
12
|
-
.
|
13
|
-
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
|
14
|
-
.publish_pact(consumer: "MyConsumer", consumer_version: "1", provider: "MyProvider", content_id: "111", tag: "feature/a")
|
15
|
-
.can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod")
|
12
|
+
.publish_pact(consumer: "MyConsumer", consumer_version: "1", provider: "MyProvider", content_id: "111", tag: "main")
|
16
13
|
.get_pacts_for_verification(
|
17
|
-
enable_pending: true,
|
18
14
|
provider_version_tag: "main",
|
19
|
-
include_wip_pacts_since: "2020-01-01",
|
20
15
|
consumer_version_selectors: [{ tag: "main", latest: true }])
|
21
|
-
|
22
|
-
index: 0,
|
23
|
-
provider_version_tag: "main",
|
24
|
-
provider_version: "1",
|
25
|
-
success: false
|
26
|
-
)
|
27
|
-
.get_pacts_for_verification(
|
28
|
-
enable_pending: true,
|
29
|
-
provider_version_tag: "main",
|
30
|
-
include_wip_pacts_since: "2020-01-01",
|
31
|
-
consumer_version_selectors: [{ tag: "main", latest: true }])
|
32
|
-
.can_i_deploy(pacticipant: "MyProvider", version: "1", to: "prod")
|
33
|
-
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
|
34
|
-
.deploy_to_prod(pacticipant: "MyProvider", version: "1")
|
35
|
-
.can_i_deploy(pacticipant: "MyConsumer", version: "1", to: "prod")
|
36
|
-
.deploy_to_prod(pacticipant: "MyConsumer", version: "1")
|
16
|
+
|
37
17
|
|
38
18
|
rescue StandardError => e
|
39
19
|
puts "#{e.class} #{e.message}"
|
@@ -46,6 +46,7 @@ module PactBroker
|
|
46
46
|
expect(subject[:_embedded][:tags].first).to include name: 'prod', latest: true
|
47
47
|
# Can't seem to stub the verification_publication_url method on the TagDecorator
|
48
48
|
expect(subject[:_embedded][:tags].first[:_links][:'pb:latest-pact'][:href]).to eq "http://example.org/pacts/provider/A%20Provider/consumer/A%20Consumer/latest/prod"
|
49
|
+
expect(subject[:_embedded][:tags].first[:_links][:self][:href]).to eq "http://example.org/pacticipants/A%20Consumer/versions/1234/tags/prod"
|
49
50
|
end
|
50
51
|
|
51
52
|
it "includes the pact contents under the contract key" do
|
@@ -66,8 +66,12 @@ module PactBroker
|
|
66
66
|
tags: [
|
67
67
|
{
|
68
68
|
name: 'prod',
|
69
|
-
latest: true
|
70
|
-
|
69
|
+
latest: true,
|
70
|
+
_links: {
|
71
|
+
self: {
|
72
|
+
href: 'http://example.org/pacticipants/Consumer/versions/1.0.0/tags/prod'
|
73
|
+
}
|
74
|
+
}
|
71
75
|
}
|
72
76
|
]
|
73
77
|
}
|
@@ -92,10 +96,14 @@ module PactBroker
|
|
92
96
|
tags: [
|
93
97
|
{
|
94
98
|
name: 'master',
|
95
|
-
latest: false
|
99
|
+
latest: false,
|
100
|
+
_links: {
|
101
|
+
self: {
|
102
|
+
href: 'http://example.org/pacticipants/Provider/versions/4.5.6/tags/master'
|
103
|
+
}
|
104
|
+
}
|
96
105
|
}
|
97
106
|
]
|
98
|
-
|
99
107
|
}
|
100
108
|
}
|
101
109
|
end
|
@@ -123,15 +131,19 @@ module PactBroker
|
|
123
131
|
}
|
124
132
|
end
|
125
133
|
|
134
|
+
let(:consumer_version) { double("consumer version", number: "1.0.0", pacticipant: double("consumer", name: "Consumer")) }
|
135
|
+
|
126
136
|
let(:consumer_version_tags) do
|
127
137
|
[
|
128
|
-
double(
|
138
|
+
double("tag", name: "prod", latest?: true, version: consumer_version)
|
129
139
|
]
|
130
140
|
end
|
131
141
|
|
142
|
+
let(:provider_version) { double("provider version", number: "4.5.6", pacticipant: double("provider", name: "Provider")) }
|
143
|
+
|
132
144
|
let(:provider_version_tags) do
|
133
145
|
[
|
134
|
-
double(
|
146
|
+
double("tag", name: "master", latest?: false, version: provider_version)
|
135
147
|
]
|
136
148
|
end
|
137
149
|
|
@@ -158,11 +170,11 @@ module PactBroker
|
|
158
170
|
let(:parsed_json) { JSON.parse(json, symbolize_names: true) }
|
159
171
|
|
160
172
|
it "includes the consumer details" do
|
161
|
-
expect(parsed_json[:matrix][0][:consumer]).to
|
173
|
+
expect(parsed_json[:matrix][0][:consumer]).to match_pact consumer_hash
|
162
174
|
end
|
163
175
|
|
164
176
|
it "includes the provider details" do
|
165
|
-
expect(parsed_json[:matrix][0][:provider]).to
|
177
|
+
expect(parsed_json[:matrix][0][:provider]).to match_pact provider_hash
|
166
178
|
end
|
167
179
|
|
168
180
|
it "includes the verification details" do
|
@@ -36,6 +36,7 @@ module PactBroker
|
|
36
36
|
pacticipant: consumer,
|
37
37
|
number: "2/4")
|
38
38
|
end
|
39
|
+
let(:tag) { double('tag', name: "feat/foo", version: version) }
|
39
40
|
|
40
41
|
matcher :match_route_in_api do |api|
|
41
42
|
match do |url|
|
@@ -168,6 +169,13 @@ module PactBroker
|
|
168
169
|
|
169
170
|
it { is_expected.to eq "http://example.org/matrix/provider/Bar%2FBar/latest/meep/consumer/Foo%2FFoo/latest/bar/badge.svg" }
|
170
171
|
end
|
172
|
+
|
173
|
+
describe "tag_url" do
|
174
|
+
subject { PactBrokerUrls.tag_url(base_url, tag) }
|
175
|
+
|
176
|
+
it { is_expected.to match_route_in_api(PactBroker::API) }
|
177
|
+
it { is_expected.to eq "http://example.org/pacticipants/Foo%2FFoo/versions/2%2F4/tags/feat%2Ffoo" }
|
178
|
+
end
|
171
179
|
end
|
172
180
|
end
|
173
181
|
end
|
@@ -53,6 +53,22 @@ module PactBroker
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
context "when the error cause class is in the warning_error_classes list" do
|
57
|
+
class TestCauseError < StandardError; end
|
58
|
+
|
59
|
+
before do
|
60
|
+
allow(PactBroker.configuration).to receive(:warning_error_classes).and_return([TestCauseError])
|
61
|
+
allow(error).to receive(:cause).and_return(TestCauseError.new)
|
62
|
+
end
|
63
|
+
|
64
|
+
let(:error) { StandardError.new("message") }
|
65
|
+
|
66
|
+
it "logs at warn so as not to wake everyone up in the middle of the night" do
|
67
|
+
expect(logger).to receive(:warn).with(/bYWfnyWPlf/, error)
|
68
|
+
subject
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
56
72
|
context "when the error is not reportable and not a warning level" do
|
57
73
|
let(:error) { PactBroker::Error.new('foo') }
|
58
74
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'pact_broker/pacts/selected_pact'
|
2
|
+
|
3
|
+
module PactBroker
|
4
|
+
module Pacts
|
5
|
+
describe SelectedPact do
|
6
|
+
describe ".merge" do
|
7
|
+
let(:pact_1) { double("pact 1", consumer_version_number: "1", consumer_version: double("version", order: 1)) }
|
8
|
+
let(:selectors_1) { Selectors.new([Selector.overall_latest]) }
|
9
|
+
let(:selected_pact_1) { SelectedPact.new(pact_1, selectors_1) }
|
10
|
+
|
11
|
+
let(:pact_2) { double("pact 2", consumer_version_number: "2", consumer_version: double("version", order: 2)) }
|
12
|
+
let(:selectors_2) { Selectors.new([Selector.latest_for_tag("foo")]) }
|
13
|
+
let(:selected_pact_2) { SelectedPact.new(pact_2, selectors_2) }
|
14
|
+
|
15
|
+
subject { SelectedPact.merge([selected_pact_1, selected_pact_2]) }
|
16
|
+
|
17
|
+
it "merges them" do
|
18
|
+
expect(subject.selectors).to eq Selectors.new([Selector.overall_latest, Selector.latest_for_tag("foo")])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
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.73.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-12-
|
13
|
+
date: 2020-12-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -965,6 +965,7 @@ files:
|
|
965
965
|
- lib/rack/pact_broker/ui_authentication.rb
|
966
966
|
- lib/rack/pact_broker/ui_request_filter.rb
|
967
967
|
- lib/rack/pact_broker/use_when.rb
|
968
|
+
- lib/sequel/extensions/statement_timeout.rb
|
968
969
|
- lib/sequel/plugins/insert_ignore.rb
|
969
970
|
- lib/sequel/plugins/upsert.rb
|
970
971
|
- lib/webmachine/rack_adapter_monkey_patch.rb
|
@@ -1055,6 +1056,7 @@ files:
|
|
1055
1056
|
- script/recreate-test-database.sh
|
1056
1057
|
- script/release-via-github-action.sh
|
1057
1058
|
- script/release.sh
|
1059
|
+
- script/reproduce-issue-starting-up.rb
|
1058
1060
|
- script/reproduce-issue.rb
|
1059
1061
|
- script/restart.sh
|
1060
1062
|
- script/run-with-ssl.rb
|
@@ -1299,6 +1301,7 @@ files:
|
|
1299
1301
|
- spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb
|
1300
1302
|
- spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb
|
1301
1303
|
- spec/lib/pact_broker/pacts/repository_spec.rb
|
1304
|
+
- spec/lib/pact_broker/pacts/selected_pact_spec.rb
|
1302
1305
|
- spec/lib/pact_broker/pacts/selector_spec.rb
|
1303
1306
|
- spec/lib/pact_broker/pacts/selectors_spec.rb
|
1304
1307
|
- spec/lib/pact_broker/pacts/service_find_for_verification_spec.rb
|
@@ -1460,7 +1463,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1460
1463
|
- !ruby/object:Gem::Version
|
1461
1464
|
version: '0'
|
1462
1465
|
requirements: []
|
1463
|
-
rubygems_version: 3.1
|
1466
|
+
rubygems_version: 3.2.1
|
1464
1467
|
signing_key:
|
1465
1468
|
specification_version: 4
|
1466
1469
|
summary: See description
|
@@ -1697,6 +1700,7 @@ test_files:
|
|
1697
1700
|
- spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb
|
1698
1701
|
- spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb
|
1699
1702
|
- spec/lib/pact_broker/pacts/repository_spec.rb
|
1703
|
+
- spec/lib/pact_broker/pacts/selected_pact_spec.rb
|
1700
1704
|
- spec/lib/pact_broker/pacts/selector_spec.rb
|
1701
1705
|
- spec/lib/pact_broker/pacts/selectors_spec.rb
|
1702
1706
|
- spec/lib/pact_broker/pacts/service_find_for_verification_spec.rb
|