pact_broker 2.72.0 → 2.76.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/.optic/.gitignore +2 -0
- data/.optic/api/specification.json +1 -0
- data/.optic/ignore +14 -0
- data/CHANGELOG.md +66 -0
- data/DEVELOPER_SETUP.md +9 -0
- data/Dockerfile +1 -0
- data/ISSUES.md +3 -3
- data/README.md +1 -1
- data/config/database.yml +1 -1
- data/db/migrations/20210115_add_webhook_foreign_key_indexes.rb +49 -0
- data/db/migrations/20210116_add_context_to_triggered_webhook.rb +11 -0
- data/db/migrations/migration_helper.rb +8 -0
- data/docker-compose-issue-repro-with-pact-broker-docker-image.yml +33 -0
- data/docker-compose-test.yml +4 -4
- data/lib/db.rb +1 -0
- data/lib/pact_broker/api.rb +13 -2
- data/lib/pact_broker/api/decorators.rb +3 -7
- data/lib/pact_broker/api/decorators/configuration.rb +33 -0
- data/lib/pact_broker/api/decorators/decorator_context_creator.rb +13 -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/pact_collection_decorator.rb +1 -0
- data/lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb +2 -3
- data/lib/pact_broker/api/decorators/reason_decorator.rb +2 -0
- data/lib/pact_broker/api/decorators/tag_decorator.rb +0 -3
- data/lib/pact_broker/api/decorators/verifiable_pact_decorator.rb +3 -1
- data/lib/pact_broker/api/pact_broker_urls.rb +4 -4
- data/lib/pact_broker/api/paths.rb +5 -0
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +2 -2
- data/lib/pact_broker/api/resources/all_webhooks.rb +3 -3
- data/lib/pact_broker/api/resources/can_i_deploy_badge.rb +1 -1
- data/lib/pact_broker/api/resources/dashboard.rb +2 -2
- data/lib/pact_broker/api/resources/default_base_resource.rb +37 -12
- data/lib/pact_broker/api/resources/error_handler.rb +1 -1
- data/lib/pact_broker/api/resources/error_response_body_generator.rb +41 -0
- data/lib/pact_broker/api/resources/group.rb +1 -1
- data/lib/pact_broker/api/resources/integrations.rb +1 -1
- data/lib/pact_broker/api/resources/label.rb +1 -1
- data/lib/pact_broker/api/resources/latest_pact.rb +2 -2
- data/lib/pact_broker/api/resources/latest_pacts.rb +1 -1
- data/lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb +2 -2
- data/lib/pact_broker/api/resources/matrix.rb +2 -2
- data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +1 -1
- data/lib/pact_broker/api/resources/metadata_resource_methods.rb +2 -1
- data/lib/pact_broker/api/resources/pact.rb +2 -2
- data/lib/pact_broker/api/resources/pact_triggered_webhooks.rb +1 -1
- data/lib/pact_broker/api/resources/pact_versions.rb +1 -1
- data/lib/pact_broker/api/resources/pact_webhooks.rb +3 -3
- data/lib/pact_broker/api/resources/pact_webhooks_status.rb +2 -2
- data/lib/pact_broker/api/resources/pacticipant.rb +1 -1
- data/lib/pact_broker/api/resources/pacticipants.rb +3 -3
- data/lib/pact_broker/api/resources/pacticipants_for_label.rb +1 -1
- data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +1 -1
- data/lib/pact_broker/api/resources/provider_pacts.rb +1 -7
- data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +2 -2
- data/lib/pact_broker/api/resources/relationships.rb +1 -1
- data/lib/pact_broker/api/resources/tag.rb +1 -1
- data/lib/pact_broker/api/resources/tagged_pact_versions.rb +1 -1
- data/lib/pact_broker/api/resources/verification.rb +2 -2
- data/lib/pact_broker/api/resources/verification_triggered_webhooks.rb +1 -1
- data/lib/pact_broker/api/resources/verifications.rb +1 -1
- data/lib/pact_broker/api/resources/version.rb +1 -1
- data/lib/pact_broker/api/resources/versions.rb +1 -1
- data/lib/pact_broker/api/resources/webhook.rb +2 -2
- data/lib/pact_broker/api/resources/webhook_execution.rb +4 -4
- data/lib/pact_broker/api/resources/webhook_execution_methods.rb +1 -3
- data/lib/pact_broker/api/resources/webhooks.rb +3 -3
- data/lib/pact_broker/app.rb +14 -3
- data/lib/pact_broker/application_context.rb +41 -0
- data/lib/pact_broker/configuration.rb +12 -4
- data/lib/pact_broker/doc/controllers/app.rb +3 -2
- data/lib/pact_broker/domain/version.rb +13 -6
- data/lib/pact_broker/domain/webhook_request.rb +1 -1
- data/lib/pact_broker/error.rb +0 -2
- data/lib/pact_broker/errors.rb +28 -0
- data/lib/pact_broker/errors/error_logger.rb +25 -0
- data/lib/pact_broker/metrics/service.rb +12 -1
- data/lib/pact_broker/pacts/metadata.rb +53 -8
- data/lib/pact_broker/pacts/repository.rb +10 -17
- data/lib/pact_broker/pacts/selector.rb +22 -0
- data/lib/pact_broker/pacts/selectors.rb +4 -0
- data/lib/pact_broker/services.rb +106 -31
- data/lib/pact_broker/tags/tag_with_latest_flag.rb +2 -0
- data/lib/pact_broker/test/http_test_data_builder.rb +83 -21
- data/lib/pact_broker/test/test_data_builder.rb +3 -2
- data/lib/pact_broker/ui/views/index/_getting-started.haml +1 -1
- data/lib/pact_broker/ui/views/index/show-with-tags.haml +16 -16
- data/lib/pact_broker/ui/views/index/show.haml +6 -6
- data/lib/pact_broker/ui/views/layouts/main.haml +2 -2
- data/lib/pact_broker/ui/views/matrix/show.haml +32 -33
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/execution_configuration.rb +4 -0
- data/lib/pact_broker/webhooks/execution_configuration_creator.rb +14 -0
- data/lib/pact_broker/webhooks/repository.rb +3 -2
- data/lib/pact_broker/webhooks/service.rb +2 -1
- data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -0
- data/lib/rack/pact_broker/hal_browser_redirect.rb +42 -0
- data/lib/rack/pact_broker/set_base_url.rb +22 -0
- data/lib/sequel/extensions/statement_timeout.rb +22 -0
- data/optic.yml +5 -0
- data/pact_broker.gemspec +1 -1
- data/public/css/bootstrap-grid.css +3719 -0
- data/public/css/bootstrap-grid.css.map +1 -0
- data/public/css/bootstrap-grid.min.css +7 -0
- data/public/css/bootstrap-grid.min.css.map +1 -0
- data/public/css/bootstrap-reboot.css +331 -0
- data/public/css/bootstrap-reboot.css.map +1 -0
- data/public/css/bootstrap-reboot.min.css +8 -0
- data/public/css/bootstrap-reboot.min.css.map +1 -0
- data/public/css/bootstrap.css +8885 -5604
- data/public/css/bootstrap.css.map +1 -1
- data/public/css/bootstrap.min.css +4 -3
- data/public/css/bootstrap.min.css.map +1 -1
- data/public/images/alert.svg +1 -0
- data/public/images/arrow-switch.svg +1 -0
- data/public/images/check.svg +1 -0
- data/public/images/clock.svg +1 -0
- data/public/images/copy.svg +1 -0
- data/public/images/kebab-horizontal.svg +1 -0
- data/public/javascripts/clipboard.js +3 -3
- data/public/javascripts/{jquery-3.3.1.js → jquery-3.5.1.js} +1150 -642
- data/public/javascripts/jquery-3.5.1.min.js +2 -0
- data/public/javascripts/jquery-3.5.1.min.map +1 -0
- data/public/javascripts/matrix.js +2 -2
- data/public/js/bootstrap.bundle.js +7013 -0
- data/public/js/bootstrap.bundle.js.map +1 -0
- data/public/js/bootstrap.bundle.min.js +7 -0
- data/public/js/bootstrap.bundle.min.js.map +1 -0
- data/public/js/bootstrap.js +3862 -1804
- data/public/js/bootstrap.js.map +1 -0
- data/public/js/bootstrap.min.js +6 -6
- data/public/js/bootstrap.min.js.map +1 -0
- data/public/stylesheets/index.css +56 -3
- data/public/stylesheets/matrix.css +55 -5
- data/public/stylesheets/pact.css +14 -0
- data/regression/.gitignore +1 -0
- data/regression/can_i_deploy_spec.rb +42 -0
- data/regression/regression_helper.rb +37 -0
- data/regression/script/approval-all.sh +6 -0
- data/script/exercise-api-for-optic.sh +3 -0
- data/script/reproduce-issue-starting-up.rb +43 -0
- data/script/reproduce-issue.rb +9 -21
- 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/decorators/verifiable_pact_decorator_spec.rb +5 -7
- data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +10 -6
- data/spec/lib/pact_broker/api/resources/can_i_deploy_badge_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/default_base_resource_spec.rb +59 -10
- data/spec/lib/pact_broker/api/resources/error_response_body_generator_spec.rb +69 -0
- data/spec/lib/pact_broker/db/log_quietener_spec.rb +1 -1
- data/spec/lib/pact_broker/doc/controllers/app_spec.rb +3 -5
- data/spec/lib/pact_broker/errors/error_logger_spec.rb +62 -0
- data/spec/lib/pact_broker/errors_spec.rb +55 -0
- data/spec/lib/pact_broker/pacts/metadata_spec.rb +73 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_fallback_spec.rb +2 -2
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +33 -13
- data/spec/lib/pact_broker/pacts/selected_pact_spec.rb +23 -0
- data/spec/lib/pact_broker/webhooks/repository_spec.rb +5 -2
- data/spec/lib/pact_broker/webhooks/service_spec.rb +2 -1
- data/spec/lib/rack/pact_broker/hal_browser_redirect_spec.rb +27 -0
- data/tasks/rspec.rake +6 -0
- metadata +65 -17
- data/public/css/bootstrap-theme.css +0 -587
- data/public/css/bootstrap-theme.css.map +0 -1
- data/public/css/bootstrap-theme.min.css +0 -6
- data/public/css/bootstrap-theme.min.css.map +0 -1
- data/public/fonts/glyphicons-halflings-regular.svg +0 -288
- data/public/javascripts/jquery-3.3.1.min.js +0 -2
- data/public/javascripts/jquery-3.3.1.min.map +0 -1
- data/spec/lib/pact_broker/api/resources/error_handler_spec.rb +0 -195
@@ -30,7 +30,7 @@ module PactBroker
|
|
30
30
|
context "when a pact exists for the main tag" do
|
31
31
|
it "returns the pact with the main tag" do
|
32
32
|
expect(find_by_consumer_version_number("2")).to_not be nil
|
33
|
-
expect(find_by_consumer_version_number("2").selectors.first).to eq Selector.latest_for_tag(tag)
|
33
|
+
expect(find_by_consumer_version_number("2").selectors.first).to eq Selector.latest_for_tag(tag).resolve(PactBroker::Domain::Version.for("Foo", "2"))
|
34
34
|
end
|
35
35
|
|
36
36
|
it "does not set the fallback_tag on the selector" do
|
@@ -67,7 +67,7 @@ module PactBroker
|
|
67
67
|
it "only returns the pacts for the consumer" do
|
68
68
|
expect(subject.size).to eq 1
|
69
69
|
expect(subject.first.consumer.name).to eq "Foo"
|
70
|
-
expect(subject.first.selectors.first).to eq selector
|
70
|
+
expect(subject.first.selectors.first).to eq selector.resolve(PactBroker::Domain::Version.for("Foo", "1"))
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -3,8 +3,6 @@ require 'pact_broker/pacts/repository'
|
|
3
3
|
module PactBroker
|
4
4
|
module Pacts
|
5
5
|
describe Repository do
|
6
|
-
let(:td) { TestDataBuilder.new }
|
7
|
-
|
8
6
|
describe "#find_for_verification" do
|
9
7
|
def find_by_consumer_version_number(consumer_version_number)
|
10
8
|
subject.find{ |pact| pact.consumer_version_number == consumer_version_number }
|
@@ -55,8 +53,8 @@ module PactBroker
|
|
55
53
|
|
56
54
|
it "returns the latest pact for each consumer" do
|
57
55
|
expect(subject.size).to eq 2
|
58
|
-
expect(find_by_consumer_name_and_consumer_version_number("Foo1", "2").selectors).to eq [Selector.overall_latest]
|
59
|
-
expect(find_by_consumer_name_and_consumer_version_number("Foo2", "3").selectors).to eq [Selector.overall_latest]
|
56
|
+
expect(find_by_consumer_name_and_consumer_version_number("Foo1", "2").selectors).to eq [Selector.overall_latest.resolve(PactBroker::Domain::Version.find(number: "2"))]
|
57
|
+
expect(find_by_consumer_name_and_consumer_version_number("Foo2", "3").selectors).to eq [Selector.overall_latest.resolve(PactBroker::Domain::Version.find(number: "3"))]
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
@@ -76,7 +74,7 @@ module PactBroker
|
|
76
74
|
|
77
75
|
it "returns the latest pact for each consumer" do
|
78
76
|
expect(subject.size).to eq 1
|
79
|
-
expect(find_by_consumer_name_and_consumer_version_number("Foo1", "2").selectors).to eq [pact_selector_1]
|
77
|
+
expect(find_by_consumer_name_and_consumer_version_number("Foo1", "2").selectors).to eq [pact_selector_1.resolve(PactBroker::Domain::Version.find(number: "2"))]
|
80
78
|
end
|
81
79
|
end
|
82
80
|
|
@@ -98,7 +96,8 @@ module PactBroker
|
|
98
96
|
|
99
97
|
it "returns the latest pact for each consumer" do
|
100
98
|
expect(subject.size).to eq 1
|
101
|
-
|
99
|
+
expected_consumer_version = PactBroker::Domain::Version.where_pacticipant_name("Foo1").where(number: "1").single_record
|
100
|
+
expect(find_by_consumer_name_and_consumer_version_number("Foo1", "1").selectors).to eq [pact_selector_1.resolve(expected_consumer_version)]
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
@@ -122,11 +121,17 @@ module PactBroker
|
|
122
121
|
let(:consumer_version_selectors) do
|
123
122
|
Selectors.new(pact_selector_1, pact_selector_2)
|
124
123
|
end
|
124
|
+
let(:expected_sorted_selectors) do
|
125
|
+
[
|
126
|
+
ResolvedSelector.new({ tag: 'dev', latest: true }, PactBroker::Domain::Version.for("Baz", "baz-latest-dev-version")),
|
127
|
+
ResolvedSelector.new({ tag: 'prod', latest: true }, PactBroker::Domain::Version.for("Baz", "baz-latest-dev-version"))
|
128
|
+
]
|
129
|
+
end
|
125
130
|
|
126
131
|
it "returns the latest pact with the specified tags for each consumer" do
|
127
|
-
expect(find_by_consumer_version_number("foo-latest-prod-version").selectors).to eq [Selector.latest_for_tag('prod')]
|
128
|
-
expect(find_by_consumer_version_number("foo-latest-dev-version").selectors).to eq [Selector.latest_for_tag('dev')]
|
129
|
-
expect(find_by_consumer_version_number("baz-latest-dev-version").selectors.sort_by{ |s| s[:tag] }).to eq
|
132
|
+
expect(find_by_consumer_version_number("foo-latest-prod-version").selectors).to eq [Selector.latest_for_tag('prod').resolve(PactBroker::Domain::Version.for("Foo", "foo-latest-prod-version"))]
|
133
|
+
expect(find_by_consumer_version_number("foo-latest-dev-version").selectors).to eq [Selector.latest_for_tag('dev').resolve(PactBroker::Domain::Version.for("Foo", "foo-latest-dev-version"))]
|
134
|
+
expect(find_by_consumer_version_number("baz-latest-dev-version").selectors.sort_by{ |s| s[:tag] }).to eq expected_sorted_selectors
|
130
135
|
expect(subject.size).to eq 3
|
131
136
|
end
|
132
137
|
|
@@ -134,14 +139,29 @@ module PactBroker
|
|
134
139
|
expect(find_by_consumer_version_number("foo-latest-prod-version").selectors.collect(&:tag)).to eq ['prod']
|
135
140
|
end
|
136
141
|
|
137
|
-
context "when a consumer name is specified"
|
142
|
+
context "when a consumer name is specified" do
|
143
|
+
before do
|
144
|
+
td.create_pact_with_hierarchy("Foo", "2", "Bar")
|
145
|
+
.create_consumer_version_tag("prod")
|
146
|
+
.create_pact_with_hierarchy("Foo", "3", "Bar")
|
147
|
+
.create_consumer_version_tag("prod")
|
148
|
+
.create_consumer_version("4")
|
149
|
+
.create_consumer_version_tag("prod")
|
150
|
+
.republish_same_pact
|
151
|
+
end
|
152
|
+
|
138
153
|
let(:consumer_version_selectors) do
|
139
154
|
Selectors.new(Selector.all_for_tag_and_consumer('prod', 'Foo'))
|
140
155
|
end
|
141
156
|
|
142
|
-
it "
|
157
|
+
it "returns all the pacts with that tag for that consumer" do
|
143
158
|
expect(subject.size).to eq 3
|
144
|
-
expect(find_by_consumer_version_number("foo-latest-prod-version").selectors).to eq [Selector.all_for_tag_and_consumer('prod', 'Foo')]
|
159
|
+
expect(find_by_consumer_version_number("foo-latest-prod-version").selectors).to eq [Selector.all_for_tag_and_consumer('prod', 'Foo').resolve(PactBroker::Domain::Version.for("Foo", "foo-latest-prod-version"))]
|
160
|
+
end
|
161
|
+
|
162
|
+
it "uses the latest consumer verison number as the resolved version when the same pact content is selected multiple times" do
|
163
|
+
expect(find_by_consumer_version_number("3")).to be nil
|
164
|
+
expect(find_by_consumer_version_number("4").selectors).to eq [Selector.all_for_tag_and_consumer('prod', 'Foo').resolve(PactBroker::Domain::Version.for("Foo", "4"))]
|
145
165
|
end
|
146
166
|
end
|
147
167
|
end
|
@@ -246,7 +266,7 @@ module PactBroker
|
|
246
266
|
end
|
247
267
|
|
248
268
|
it "does not set the tag name" do
|
249
|
-
expect(find_by_consumer_version_number("foo-latest-dev-version").selectors).to eq [{ latest: true }]
|
269
|
+
expect(find_by_consumer_version_number("foo-latest-dev-version").selectors).to eq [ResolvedSelector.new({ latest: true }, PactBroker::Domain::Version.find(number: "foo-latest-dev-version"))]
|
250
270
|
expect(find_by_consumer_version_number("foo-latest-dev-version").overall_latest?).to be true
|
251
271
|
end
|
252
272
|
end
|
@@ -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
|
@@ -386,7 +386,9 @@ module PactBroker
|
|
386
386
|
.create_verification
|
387
387
|
end
|
388
388
|
|
389
|
-
|
389
|
+
let(:event_context) { { 'some' => 'info' } }
|
390
|
+
|
391
|
+
subject { Repository.new.create_triggered_webhook '1234', td.webhook, td.pact, td.verification, 'publication', 'some_event', event_context }
|
390
392
|
|
391
393
|
it "creates a TriggeredWebhook" do
|
392
394
|
expect(subject.webhook_uuid ).to eq td.webhook.uuid
|
@@ -396,6 +398,7 @@ module PactBroker
|
|
396
398
|
expect(subject.trigger_uuid).to eq '1234'
|
397
399
|
expect(subject.trigger_type).to eq 'publication'
|
398
400
|
expect(subject.event_name).to eq 'some_event'
|
401
|
+
expect(subject.event_context).to eq event_context
|
399
402
|
end
|
400
403
|
|
401
404
|
it "sets the webhook" do
|
@@ -419,7 +422,7 @@ module PactBroker
|
|
419
422
|
end
|
420
423
|
|
421
424
|
context "without a verification" do
|
422
|
-
subject { Repository.new.create_triggered_webhook '1234', td.webhook, td.pact, nil, 'publication', 'some_event' }
|
425
|
+
subject { Repository.new.create_triggered_webhook '1234', td.webhook, td.pact, nil, 'publication', 'some_event', {} }
|
423
426
|
|
424
427
|
it "does not set the verification" do
|
425
428
|
expect(subject.verification).to be nil
|
@@ -180,7 +180,8 @@ module PactBroker
|
|
180
180
|
let(:provider) { PactBroker::Domain::Pacticipant.new(name: 'Provider') }
|
181
181
|
let(:webhooks) { [instance_double(PactBroker::Domain::Webhook, description: 'description', uuid: '1244')]}
|
182
182
|
let(:triggered_webhook) { instance_double(PactBroker::Webhooks::TriggeredWebhook) }
|
183
|
-
let(:webhook_execution_configuration) { double('webhook_execution_configuration') }
|
183
|
+
let(:webhook_execution_configuration) { double('webhook_execution_configuration', webhook_context: webhook_context) }
|
184
|
+
let(:webhook_context) { double('webhook_context') }
|
184
185
|
let(:options) do
|
185
186
|
{ database_connector: double('database_connector'),
|
186
187
|
webhook_execution_configuration: webhook_execution_configuration,
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rack/pact_broker/hal_browser_redirect'
|
2
|
+
|
3
|
+
module Rack
|
4
|
+
module PactBroker
|
5
|
+
describe HalBrowserRedirect do
|
6
|
+
let(:target_app) { ->(env){ [200, {}, []] } }
|
7
|
+
let(:app) { HalBrowserRedirect.new(target_app) }
|
8
|
+
let(:rack_env) do
|
9
|
+
{
|
10
|
+
"pactbroker.base_url" => "http://base/foo",
|
11
|
+
"HTTP_ACCEPT" => "text/html"
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
subject { get(path, nil, rack_env) }
|
16
|
+
|
17
|
+
context "when requesting verification results" do
|
18
|
+
let(:path) { "/pacts/provider/Bar/consumer/Foo/pact-version/a2456ade40d0e148e23fb3310ec56831fef6ce8e/verification-results/106" }
|
19
|
+
|
20
|
+
it "redirects to the HAL browser" do
|
21
|
+
expect(subject.status).to eq 303
|
22
|
+
expect(subject.headers["Location"]).to eq "http://base/foo/hal-browser/browser.html#http://base/foo/pacts/provider/Bar/consumer/Foo/pact-version/a2456ade40d0e148e23fb3310ec56831fef6ce8e/verification-results/106"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/tasks/rspec.rake
CHANGED
@@ -9,6 +9,11 @@ RSpec::Core::RakeTask.new('spec:quick') do |task|
|
|
9
9
|
task.rspec_opts = '--tag ~@no_db_clean --tag ~@migration --format progress'
|
10
10
|
end
|
11
11
|
|
12
|
+
RSpec::Core::RakeTask.new('regression') do |task|
|
13
|
+
task.pattern = 'regression/**{,/*/**}/*_spec.rb'
|
14
|
+
task.rspec_opts = '--require regression/regression_helper.rb'
|
15
|
+
end
|
16
|
+
|
12
17
|
RSpec::Core::RakeTask.new('spec:slow') do |task|
|
13
18
|
task.rspec_opts = '--tag @no_db_clean --tag @migration --format progress'
|
14
19
|
end
|
@@ -24,3 +29,4 @@ end
|
|
24
29
|
task 'spec:quick' => ['set_simplecov_command_to_spec_quick']
|
25
30
|
task 'spec:slow' => ['set_simplecov_command_to_spec_slow']
|
26
31
|
task :spec => ['spec:quick', 'spec:slow']
|
32
|
+
|
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.76.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:
|
13
|
+
date: 2021-01-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -156,20 +156,20 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 3.
|
159
|
+
version: 3.5.1
|
160
160
|
- - "~>"
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: '3.
|
162
|
+
version: '3.5'
|
163
163
|
type: :runtime
|
164
164
|
prerelease: false
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: 3.
|
169
|
+
version: 3.5.1
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '3.
|
172
|
+
version: '3.5'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
174
|
name: pact-support
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -375,6 +375,9 @@ files:
|
|
375
375
|
- ".github/workflows/release_gem.yml"
|
376
376
|
- ".github/workflows/test.yml"
|
377
377
|
- ".gitignore"
|
378
|
+
- ".optic/.gitignore"
|
379
|
+
- ".optic/api/specification.json"
|
380
|
+
- ".optic/ignore"
|
378
381
|
- ".rspec"
|
379
382
|
- ".rubocop.yml"
|
380
383
|
- ".ruby-version"
|
@@ -527,6 +530,8 @@ files:
|
|
527
530
|
- db/migrations/20201023_create_verification_number_sequence.rb
|
528
531
|
- db/migrations/20201024_create_version_order_sequence.rb
|
529
532
|
- db/migrations/20201026_update_latest_verification_ids_for_consumer_and_provider.rb
|
533
|
+
- db/migrations/20210115_add_webhook_foreign_key_indexes.rb
|
534
|
+
- db/migrations/20210116_add_context_to_triggered_webhook.rb
|
530
535
|
- db/migrations/migration_helper.rb
|
531
536
|
- db/test/backwards_compatibility/.rspec
|
532
537
|
- db/test/backwards_compatibility/Appraisals
|
@@ -560,6 +565,7 @@ files:
|
|
560
565
|
- db/test/change_migration_strategy/before/Gemfile
|
561
566
|
- docker-compose-ci-mysql.yml
|
562
567
|
- docker-compose-dev-postgres.yml
|
568
|
+
- docker-compose-issue-repro-with-pact-broker-docker-image.yml
|
563
569
|
- docker-compose-issue-repro.yml
|
564
570
|
- docker-compose-test.yml
|
565
571
|
- docs/images/Pactflow logo - black small.png
|
@@ -600,9 +606,11 @@ files:
|
|
600
606
|
- lib/pact_broker/api/decorators.rb
|
601
607
|
- lib/pact_broker/api/decorators/base_decorator.rb
|
602
608
|
- lib/pact_broker/api/decorators/basic_pacticipant_decorator.rb
|
609
|
+
- lib/pact_broker/api/decorators/configuration.rb
|
603
610
|
- lib/pact_broker/api/decorators/dashboard_decorator.rb
|
604
611
|
- lib/pact_broker/api/decorators/dashboard_text_decorator.rb
|
605
612
|
- lib/pact_broker/api/decorators/decorator_context.rb
|
613
|
+
- lib/pact_broker/api/decorators/decorator_context_creator.rb
|
606
614
|
- lib/pact_broker/api/decorators/embedded_label_decorator.rb
|
607
615
|
- lib/pact_broker/api/decorators/embedded_tag_decorator.rb
|
608
616
|
- lib/pact_broker/api/decorators/embedded_version_decorator.rb
|
@@ -661,6 +669,7 @@ files:
|
|
661
669
|
- lib/pact_broker/api/resources/dashboard.rb
|
662
670
|
- lib/pact_broker/api/resources/default_base_resource.rb
|
663
671
|
- lib/pact_broker/api/resources/error_handler.rb
|
672
|
+
- lib/pact_broker/api/resources/error_response_body_generator.rb
|
664
673
|
- lib/pact_broker/api/resources/error_test.rb
|
665
674
|
- lib/pact_broker/api/resources/group.rb
|
666
675
|
- lib/pact_broker/api/resources/index.rb
|
@@ -708,6 +717,7 @@ files:
|
|
708
717
|
- lib/pact_broker/api/resources/webhook_resource_methods.rb
|
709
718
|
- lib/pact_broker/api/resources/webhooks.rb
|
710
719
|
- lib/pact_broker/app.rb
|
720
|
+
- lib/pact_broker/application_context.rb
|
711
721
|
- lib/pact_broker/badges/service.rb
|
712
722
|
- lib/pact_broker/build_http_options.rb
|
713
723
|
- lib/pact_broker/certificates/certificate.rb
|
@@ -801,6 +811,8 @@ files:
|
|
801
811
|
- lib/pact_broker/domain/webhook_request.rb
|
802
812
|
- lib/pact_broker/domain/webhook_request_header.rb
|
803
813
|
- lib/pact_broker/error.rb
|
814
|
+
- lib/pact_broker/errors.rb
|
815
|
+
- lib/pact_broker/errors/error_logger.rb
|
804
816
|
- lib/pact_broker/feature_toggle.rb
|
805
817
|
- lib/pact_broker/groups/service.rb
|
806
818
|
- lib/pact_broker/hash_refinements.rb
|
@@ -933,6 +945,7 @@ files:
|
|
933
945
|
- lib/pact_broker/webhooks/check_host_whitelist.rb
|
934
946
|
- lib/pact_broker/webhooks/execution.rb
|
935
947
|
- lib/pact_broker/webhooks/execution_configuration.rb
|
948
|
+
- lib/pact_broker/webhooks/execution_configuration_creator.rb
|
936
949
|
- lib/pact_broker/webhooks/http_request_with_redacted_headers.rb
|
937
950
|
- lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
|
938
951
|
- lib/pact_broker/webhooks/job.rb
|
@@ -958,39 +971,52 @@ files:
|
|
958
971
|
- lib/rack/pact_broker/convert_404_to_hal.rb
|
959
972
|
- lib/rack/pact_broker/convert_file_extension_to_accept_header.rb
|
960
973
|
- lib/rack/pact_broker/database_transaction.rb
|
974
|
+
- lib/rack/pact_broker/hal_browser_redirect.rb
|
961
975
|
- lib/rack/pact_broker/invalid_uri_protection.rb
|
962
976
|
- lib/rack/pact_broker/no_auth.rb
|
963
977
|
- lib/rack/pact_broker/request_target.rb
|
964
978
|
- lib/rack/pact_broker/reset_thread_data.rb
|
979
|
+
- lib/rack/pact_broker/set_base_url.rb
|
965
980
|
- lib/rack/pact_broker/ui_authentication.rb
|
966
981
|
- lib/rack/pact_broker/ui_request_filter.rb
|
967
982
|
- lib/rack/pact_broker/use_when.rb
|
983
|
+
- lib/sequel/extensions/statement_timeout.rb
|
968
984
|
- lib/sequel/plugins/insert_ignore.rb
|
969
985
|
- lib/sequel/plugins/upsert.rb
|
970
986
|
- lib/webmachine/rack_adapter_monkey_patch.rb
|
987
|
+
- optic.yml
|
971
988
|
- pact_broker.gemspec
|
972
989
|
- pact_broker_client-pact_broker.json
|
973
990
|
- public/Network Graph_files/d3.v3.js
|
974
991
|
- public/Network Graph_files/ga.js
|
975
992
|
- public/bootstrap.zip
|
976
993
|
- public/config.json
|
977
|
-
- public/css/bootstrap-
|
978
|
-
- public/css/bootstrap-
|
979
|
-
- public/css/bootstrap-
|
980
|
-
- public/css/bootstrap-
|
994
|
+
- public/css/bootstrap-grid.css
|
995
|
+
- public/css/bootstrap-grid.css.map
|
996
|
+
- public/css/bootstrap-grid.min.css
|
997
|
+
- public/css/bootstrap-grid.min.css.map
|
998
|
+
- public/css/bootstrap-reboot.css
|
999
|
+
- public/css/bootstrap-reboot.css.map
|
1000
|
+
- public/css/bootstrap-reboot.min.css
|
1001
|
+
- public/css/bootstrap-reboot.min.css.map
|
981
1002
|
- public/css/bootstrap.css
|
982
1003
|
- public/css/bootstrap.css.map
|
983
1004
|
- public/css/bootstrap.min.css
|
984
1005
|
- public/css/bootstrap.min.css.map
|
985
1006
|
- public/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2
|
986
1007
|
- public/fonts/glyphicons-halflings-regular.eot
|
987
|
-
- public/fonts/glyphicons-halflings-regular.svg
|
988
1008
|
- public/fonts/glyphicons-halflings-regular.ttf
|
989
1009
|
- public/fonts/glyphicons-halflings-regular.woff
|
990
1010
|
- public/fonts/glyphicons-halflings-regular.woff2
|
1011
|
+
- public/images/alert.svg
|
1012
|
+
- public/images/arrow-switch.svg
|
1013
|
+
- public/images/check.svg
|
1014
|
+
- public/images/clock.svg
|
1015
|
+
- public/images/copy.svg
|
991
1016
|
- public/images/doc-matrix.svg
|
992
1017
|
- public/images/doc-text.svg
|
993
1018
|
- public/images/favicon.ico
|
1019
|
+
- public/images/kebab-horizontal.svg
|
994
1020
|
- public/images/logo@2x.png
|
995
1021
|
- public/images/pact-changed-orange.svg
|
996
1022
|
- public/images/pact-failed-red.svg
|
@@ -1001,9 +1027,9 @@ files:
|
|
1001
1027
|
- public/javascripts/d3.v3.js.pagespeed.ce.dFNRrGTALe.js
|
1002
1028
|
- public/javascripts/highlight.pack.js
|
1003
1029
|
- public/javascripts/index.js
|
1004
|
-
- public/javascripts/jquery-3.
|
1005
|
-
- public/javascripts/jquery-3.
|
1006
|
-
- public/javascripts/jquery-3.
|
1030
|
+
- public/javascripts/jquery-3.5.1.js
|
1031
|
+
- public/javascripts/jquery-3.5.1.min.js
|
1032
|
+
- public/javascripts/jquery-3.5.1.min.map
|
1007
1033
|
- public/javascripts/jquery-confirm.min.js
|
1008
1034
|
- public/javascripts/jquery.tablesorter.js
|
1009
1035
|
- public/javascripts/jquery.tablesorter.min.js
|
@@ -1011,8 +1037,14 @@ files:
|
|
1011
1037
|
- public/javascripts/matrix.js
|
1012
1038
|
- public/javascripts/pact.js
|
1013
1039
|
- public/javascripts/pagination.js
|
1040
|
+
- public/js/bootstrap.bundle.js
|
1041
|
+
- public/js/bootstrap.bundle.js.map
|
1042
|
+
- public/js/bootstrap.bundle.min.js
|
1043
|
+
- public/js/bootstrap.bundle.min.js.map
|
1014
1044
|
- public/js/bootstrap.js
|
1045
|
+
- public/js/bootstrap.js.map
|
1015
1046
|
- public/js/bootstrap.min.js
|
1047
|
+
- public/js/bootstrap.min.js.map
|
1016
1048
|
- public/js/npm.js
|
1017
1049
|
- public/stylesheets/github-json.css
|
1018
1050
|
- public/stylesheets/github.css
|
@@ -1022,6 +1054,10 @@ files:
|
|
1022
1054
|
- public/stylesheets/material-menu.css
|
1023
1055
|
- public/stylesheets/matrix.css
|
1024
1056
|
- public/stylesheets/pact.css
|
1057
|
+
- regression/.gitignore
|
1058
|
+
- regression/can_i_deploy_spec.rb
|
1059
|
+
- regression/regression_helper.rb
|
1060
|
+
- regression/script/approval-all.sh
|
1025
1061
|
- script/db-spec.sh
|
1026
1062
|
- script/docker-container/test.sh
|
1027
1063
|
- script/docker/db-execute-sql-file.sh
|
@@ -1031,6 +1067,7 @@ files:
|
|
1031
1067
|
- script/docker/db-rm.sh
|
1032
1068
|
- script/docker/db-start.sh
|
1033
1069
|
- script/docker/mysql-db-start.sh
|
1070
|
+
- script/exercise-api-for-optic.sh
|
1034
1071
|
- script/foo-bar-verification.json
|
1035
1072
|
- script/foo-bar.json
|
1036
1073
|
- script/generate-certificates-for-webooks-certificate-spec.rb
|
@@ -1055,6 +1092,7 @@ files:
|
|
1055
1092
|
- script/recreate-test-database.sh
|
1056
1093
|
- script/release-via-github-action.sh
|
1057
1094
|
- script/release.sh
|
1095
|
+
- script/reproduce-issue-starting-up.rb
|
1058
1096
|
- script/reproduce-issue.rb
|
1059
1097
|
- script/restart.sh
|
1060
1098
|
- script/run-with-ssl.rb
|
@@ -1205,7 +1243,7 @@ files:
|
|
1205
1243
|
- spec/lib/pact_broker/api/resources/dashboard_spec.rb
|
1206
1244
|
- spec/lib/pact_broker/api/resources/default_base_resource_approval_spec.rb
|
1207
1245
|
- spec/lib/pact_broker/api/resources/default_base_resource_spec.rb
|
1208
|
-
- spec/lib/pact_broker/api/resources/
|
1246
|
+
- spec/lib/pact_broker/api/resources/error_response_body_generator_spec.rb
|
1209
1247
|
- spec/lib/pact_broker/api/resources/group_spec.rb
|
1210
1248
|
- spec/lib/pact_broker/api/resources/latest_pact_spec.rb
|
1211
1249
|
- spec/lib/pact_broker/api/resources/latest_provider_pacts_spec.rb
|
@@ -1259,6 +1297,8 @@ files:
|
|
1259
1297
|
- spec/lib/pact_broker/domain/version_spec.rb
|
1260
1298
|
- spec/lib/pact_broker/domain/webhook_request_spec.rb
|
1261
1299
|
- spec/lib/pact_broker/domain/webhook_spec.rb
|
1300
|
+
- spec/lib/pact_broker/errors/error_logger_spec.rb
|
1301
|
+
- spec/lib/pact_broker/errors_spec.rb
|
1262
1302
|
- spec/lib/pact_broker/feature_toggle_spec.rb
|
1263
1303
|
- spec/lib/pact_broker/groups/service_spec.rb
|
1264
1304
|
- spec/lib/pact_broker/hash_refinements_spec.rb
|
@@ -1292,6 +1332,7 @@ files:
|
|
1292
1332
|
- spec/lib/pact_broker/pacts/generate_sha_spec.rb
|
1293
1333
|
- spec/lib/pact_broker/pacts/latest_tagged_pact_publications_spec.rb
|
1294
1334
|
- spec/lib/pact_broker/pacts/merger_spec.rb
|
1335
|
+
- spec/lib/pact_broker/pacts/metadata_spec.rb
|
1295
1336
|
- spec/lib/pact_broker/pacts/pact_params_spec.rb
|
1296
1337
|
- spec/lib/pact_broker/pacts/pact_publication_spec.rb
|
1297
1338
|
- spec/lib/pact_broker/pacts/pact_version_spec.rb
|
@@ -1299,6 +1340,7 @@ files:
|
|
1299
1340
|
- spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb
|
1300
1341
|
- spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb
|
1301
1342
|
- spec/lib/pact_broker/pacts/repository_spec.rb
|
1343
|
+
- spec/lib/pact_broker/pacts/selected_pact_spec.rb
|
1302
1344
|
- spec/lib/pact_broker/pacts/selector_spec.rb
|
1303
1345
|
- spec/lib/pact_broker/pacts/selectors_spec.rb
|
1304
1346
|
- spec/lib/pact_broker/pacts/service_find_for_verification_spec.rb
|
@@ -1341,6 +1383,7 @@ files:
|
|
1341
1383
|
- spec/lib/rack/hal_browser/redirect_spec.rb
|
1342
1384
|
- spec/lib/rack/pact_broker/add_pact_broker_version_header_spec.rb
|
1343
1385
|
- spec/lib/rack/pact_broker/database_transaction_spec.rb
|
1386
|
+
- spec/lib/rack/pact_broker/hal_browser_redirect_spec.rb
|
1344
1387
|
- spec/lib/rack/pact_broker/invalid_uri_protection_spec.rb
|
1345
1388
|
- spec/lib/rack/pact_broker/request_target_spec.rb
|
1346
1389
|
- spec/lib/rack/pact_broker/use_when_spec.rb
|
@@ -1460,7 +1503,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1460
1503
|
- !ruby/object:Gem::Version
|
1461
1504
|
version: '0'
|
1462
1505
|
requirements: []
|
1463
|
-
rubygems_version: 3.
|
1506
|
+
rubygems_version: 3.2.6
|
1464
1507
|
signing_key:
|
1465
1508
|
specification_version: 4
|
1466
1509
|
summary: See description
|
@@ -1603,7 +1646,7 @@ test_files:
|
|
1603
1646
|
- spec/lib/pact_broker/api/resources/dashboard_spec.rb
|
1604
1647
|
- spec/lib/pact_broker/api/resources/default_base_resource_approval_spec.rb
|
1605
1648
|
- spec/lib/pact_broker/api/resources/default_base_resource_spec.rb
|
1606
|
-
- spec/lib/pact_broker/api/resources/
|
1649
|
+
- spec/lib/pact_broker/api/resources/error_response_body_generator_spec.rb
|
1607
1650
|
- spec/lib/pact_broker/api/resources/group_spec.rb
|
1608
1651
|
- spec/lib/pact_broker/api/resources/latest_pact_spec.rb
|
1609
1652
|
- spec/lib/pact_broker/api/resources/latest_provider_pacts_spec.rb
|
@@ -1657,6 +1700,8 @@ test_files:
|
|
1657
1700
|
- spec/lib/pact_broker/domain/version_spec.rb
|
1658
1701
|
- spec/lib/pact_broker/domain/webhook_request_spec.rb
|
1659
1702
|
- spec/lib/pact_broker/domain/webhook_spec.rb
|
1703
|
+
- spec/lib/pact_broker/errors/error_logger_spec.rb
|
1704
|
+
- spec/lib/pact_broker/errors_spec.rb
|
1660
1705
|
- spec/lib/pact_broker/feature_toggle_spec.rb
|
1661
1706
|
- spec/lib/pact_broker/groups/service_spec.rb
|
1662
1707
|
- spec/lib/pact_broker/hash_refinements_spec.rb
|
@@ -1690,6 +1735,7 @@ test_files:
|
|
1690
1735
|
- spec/lib/pact_broker/pacts/generate_sha_spec.rb
|
1691
1736
|
- spec/lib/pact_broker/pacts/latest_tagged_pact_publications_spec.rb
|
1692
1737
|
- spec/lib/pact_broker/pacts/merger_spec.rb
|
1738
|
+
- spec/lib/pact_broker/pacts/metadata_spec.rb
|
1693
1739
|
- spec/lib/pact_broker/pacts/pact_params_spec.rb
|
1694
1740
|
- spec/lib/pact_broker/pacts/pact_publication_spec.rb
|
1695
1741
|
- spec/lib/pact_broker/pacts/pact_version_spec.rb
|
@@ -1697,6 +1743,7 @@ test_files:
|
|
1697
1743
|
- spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb
|
1698
1744
|
- spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb
|
1699
1745
|
- spec/lib/pact_broker/pacts/repository_spec.rb
|
1746
|
+
- spec/lib/pact_broker/pacts/selected_pact_spec.rb
|
1700
1747
|
- spec/lib/pact_broker/pacts/selector_spec.rb
|
1701
1748
|
- spec/lib/pact_broker/pacts/selectors_spec.rb
|
1702
1749
|
- spec/lib/pact_broker/pacts/service_find_for_verification_spec.rb
|
@@ -1739,6 +1786,7 @@ test_files:
|
|
1739
1786
|
- spec/lib/rack/hal_browser/redirect_spec.rb
|
1740
1787
|
- spec/lib/rack/pact_broker/add_pact_broker_version_header_spec.rb
|
1741
1788
|
- spec/lib/rack/pact_broker/database_transaction_spec.rb
|
1789
|
+
- spec/lib/rack/pact_broker/hal_browser_redirect_spec.rb
|
1742
1790
|
- spec/lib/rack/pact_broker/invalid_uri_protection_spec.rb
|
1743
1791
|
- spec/lib/rack/pact_broker/request_target_spec.rb
|
1744
1792
|
- spec/lib/rack/pact_broker/use_when_spec.rb
|