pact_broker 2.82.0 → 2.85.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +53 -0
- data/Dockerfile +1 -1
- data/db/migrations/20210815_add_provider_version_id_index_to_verifications.rb +7 -0
- data/db/migrations/20210816_create_branches_tables.rb +40 -0
- data/db/migrations/20210818_add_consumer_version_selectors_to_verification.rb +8 -0
- data/db/migrations/20210831_add_index_to_pact_publications.rb +7 -0
- data/db/migrations/20210908_add_auto_created.rb +24 -0
- data/db/migrations/20210913_add_pending_to_verifications.rb +7 -0
- data/issue-reproduction/Dockerfile-pact-broker +1 -1
- data/lib/pact/doc/markdown/consumer_contract_renderer.rb +3 -3
- data/lib/pact_broker/api/contracts/{verifiable_pacts_json_query_schema.rb → pacts_for_verification_json_query_schema.rb} +1 -1
- data/lib/pact_broker/api/contracts/{verifiable_pacts_query_schema.rb → pacts_for_verification_query_string_schema.rb} +1 -1
- data/lib/pact_broker/api/decorators/branch_version_decorator.rb +20 -0
- data/lib/pact_broker/api/decorators/dashboard_decorator.rb +4 -2
- data/lib/pact_broker/api/decorators/embedded_branch_version_decorator.rb +21 -0
- data/lib/pact_broker/api/decorators/embedded_tag_decorator.rb +0 -5
- data/lib/pact_broker/api/decorators/matrix_decorator.rb +11 -2
- data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +8 -0
- data/lib/pact_broker/api/decorators/{verifiable_pacts_query_decorator.rb → pacts_for_verification_query_decorator.rb} +2 -2
- data/lib/pact_broker/api/decorators/reason_decorator.rb +2 -2
- data/lib/pact_broker/api/decorators/verification_summary_decorator.rb +1 -2
- data/lib/pact_broker/api/decorators/version_decorator.rb +1 -1
- data/lib/pact_broker/api/middleware/configuration.rb +33 -0
- data/lib/pact_broker/api/pact_broker_urls.rb +13 -1
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +15 -11
- data/lib/pact_broker/api/resources/branch_version.rb +48 -0
- data/lib/pact_broker/api/resources/index.rb +6 -0
- data/lib/pact_broker/api/resources/pact_versions_for_branch.rb +40 -0
- data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +6 -6
- data/lib/pact_broker/api/resources/verifications.rb +7 -2
- data/lib/pact_broker/api/resources/version.rb +0 -8
- data/lib/pact_broker/api.rb +2 -0
- data/lib/pact_broker/app.rb +2 -0
- data/lib/pact_broker/badges/service.rb +3 -1
- data/lib/pact_broker/config/runtime_configuration.rb +12 -0
- data/lib/pact_broker/configuration.rb +33 -29
- data/lib/pact_broker/contracts/service.rb +1 -1
- data/lib/pact_broker/db/clean/selector.rb +54 -0
- data/lib/pact_broker/db/clean.rb +7 -1
- data/lib/pact_broker/db/clean_incremental.rb +13 -5
- data/lib/pact_broker/db/data_migrations/create_branches.rb +97 -0
- data/lib/pact_broker/db/data_migrations/set_pacticipant_main_branch.rb +2 -0
- data/lib/pact_broker/db/migrate_data.rb +1 -1
- data/lib/pact_broker/db/models.rb +6 -0
- data/lib/pact_broker/deployments/deployed_version.rb +4 -0
- data/lib/pact_broker/deployments/deployed_version_service.rb +4 -3
- data/lib/pact_broker/deployments/environment.rb +4 -0
- data/lib/pact_broker/deployments/environment_service.rb +13 -8
- data/lib/pact_broker/diagnostic/resources/base_resource.rb +4 -0
- data/lib/pact_broker/diagnostic/resources/dependencies.rb +1 -1
- data/lib/pact_broker/diagnostic/resources/heartbeat.rb +2 -3
- data/lib/pact_broker/doc/views/index/pacticipant-branch-version.markdown +14 -0
- data/lib/pact_broker/doc/views/webhooks.markdown +1 -0
- data/lib/pact_broker/domain/index_item.rb +15 -17
- data/lib/pact_broker/domain/pacticipant.rb +11 -0
- data/lib/pact_broker/domain/tag.rb +1 -2
- data/lib/pact_broker/domain/verification.rb +29 -14
- data/lib/pact_broker/domain/version.rb +112 -29
- data/lib/pact_broker/domain/webhook.rb +22 -10
- data/lib/pact_broker/domain/webhook_request.rb +2 -2
- data/lib/pact_broker/index/service.rb +83 -28
- data/lib/pact_broker/locale/en.yml +4 -0
- data/lib/pact_broker/matrix/quick_row.rb +6 -6
- data/lib/pact_broker/matrix/service.rb +4 -0
- data/lib/pact_broker/matrix/unresolved_selector.rb +3 -2
- data/lib/pact_broker/metrics/service.rb +7 -1
- data/lib/pact_broker/pacts/metadata.rb +7 -2
- data/lib/pact_broker/pacts/pact_publication.rb +59 -25
- data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +113 -33
- data/lib/pact_broker/pacts/pact_publication_selector_dataset_module.rb +18 -13
- data/lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb +16 -4
- data/lib/pact_broker/pacts/pact_version.rb +13 -1
- data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +4 -10
- data/lib/pact_broker/pacts/repository.rb +6 -1
- data/lib/pact_broker/pacts/selected_pact.rb +20 -0
- data/lib/pact_broker/pacts/selector.rb +98 -33
- data/lib/pact_broker/pacts/service.rb +21 -0
- data/lib/pact_broker/repositories.rb +5 -0
- data/lib/pact_broker/services.rb +9 -0
- data/lib/pact_broker/test/http_test_data_builder.rb +35 -9
- data/lib/pact_broker/test/test_data_builder.rb +32 -26
- data/lib/pact_broker/ui/app.rb +7 -1
- data/lib/pact_broker/ui/controllers/dashboard.rb +80 -0
- data/lib/pact_broker/ui/controllers/groups.rb +23 -8
- data/lib/pact_broker/ui/helpers/url_helper.rb +5 -1
- data/lib/pact_broker/ui/view_models/index_item.rb +56 -3
- data/lib/pact_broker/ui/view_models/matrix_branch.rb +39 -0
- data/lib/pact_broker/ui/view_models/matrix_line.rb +11 -16
- data/lib/pact_broker/ui/view_models/matrix_tag.rb +0 -1
- data/lib/pact_broker/ui/views/dashboard/show.haml +195 -0
- data/lib/pact_broker/ui/views/groups/show.html.erb +60 -14
- data/lib/pact_broker/ui/views/index/_dashboard_navbar.haml +7 -0
- data/lib/pact_broker/ui/views/index/_navbar.haml +0 -7
- data/lib/pact_broker/ui/views/index/show-with-tags.haml +14 -11
- data/lib/pact_broker/ui/views/index/show.haml +35 -13
- data/lib/pact_broker/ui/views/matrix/show.haml +15 -11
- data/lib/pact_broker/verifications/pseudo_branch_status.rb +2 -0
- data/lib/pact_broker/verifications/repository.rb +6 -11
- data/lib/pact_broker/verifications/service.rb +11 -5
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/branch.rb +29 -0
- data/lib/pact_broker/versions/branch_head.rb +45 -0
- data/lib/pact_broker/versions/branch_service.rb +24 -0
- data/lib/pact_broker/versions/branch_version.rb +64 -0
- data/lib/pact_broker/versions/branch_version_repository.rb +34 -0
- data/lib/pact_broker/versions/eager_loaders.rb +0 -42
- data/lib/pact_broker/versions/repository.rb +25 -12
- data/lib/pact_broker/versions/service.rb +3 -22
- data/lib/pact_broker/webhooks/event_listener.rb +3 -3
- data/lib/pact_broker/webhooks/execution_configuration.rb +16 -0
- data/lib/pact_broker/webhooks/execution_configuration_creator.rb +3 -0
- data/lib/pact_broker/webhooks/job.rb +1 -1
- data/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +20 -3
- data/lib/pact_broker/webhooks/trigger_service.rb +2 -2
- data/lib/pact_broker/webhooks/webhook_execution_result.rb +3 -7
- data/lib/pact_broker/webhooks/webhook_request_logger.rb +4 -12
- data/lib/pact_broker/webhooks/webhook_request_template.rb +6 -8
- data/lib/sequel/plugins/insert_ignore.rb +4 -0
- data/lib/sequel/plugins/upsert.rb +4 -0
- data/pact_broker.gemspec +4 -0
- data/public/javascripts/index.js +152 -50
- data/public/javascripts/pact.js +14 -14
- data/public/stylesheets/index.css +1 -2
- data/public/stylesheets/pact.css +11 -0
- data/scaffolding/templates/decorator.rb.erb +3 -1
- data/scaffolding/templates/migration.erb +1 -1
- data/scaffolding/templates/model.erb +2 -2
- data/scaffolding/templates/repository.rb.erb +2 -2
- data/scaffolding/templates/repository_spec.rb.erb +1 -1
- data/scaffolding/templates/resource.erb +2 -2
- data/scaffolding/templates/resource_spec.rb.erb +1 -1
- data/scaffolding/templates/service.rb.erb +3 -3
- data/scaffolding/templates/service_spec.rb.erb +1 -1
- data/script/data/auto-create-things-for-tags.rb +2 -0
- data/script/data/branches.rb +35 -0
- data/script/data/contract-published-requiring-verification.rb +1 -1
- data/script/data/environments.rb +0 -0
- data/script/data/issue-494.rb +25 -0
- data/script/data/pending.rb +26 -0
- data/script/data/tags.rb +35 -0
- data/script/data/webhook.rb +22 -0
- data/script/seed.rb +50 -89
- data/spec/features/create_branch_version_spec.rb +29 -0
- data/spec/features/create_tag_spec.rb +1 -1
- data/spec/features/create_version_spec.rb +2 -4
- data/spec/features/delete_pact_versions_for_branch_spec.rb +34 -0
- data/spec/features/get_branch_version_spec.rb +12 -0
- data/spec/features/publish_pact_all_in_one_spec.rb +0 -1
- data/spec/features/update_version_spec.rb +0 -55
- data/spec/fixtures/approvals/modifiable_resources.approved.json +7 -0
- data/spec/fixtures/approvals/publish_contract_nothing_exists.approved.json +1 -2
- data/spec/fixtures/approvals/publish_contract_nothing_exists_with_webhook.approved.json +1 -2
- data/spec/fixtures/approvals/publish_contract_verification_already_exists.approved.json +1 -2
- data/spec/fixtures/dashboard.json +4 -2
- data/spec/integration/app_spec.rb +6 -6
- data/spec/integration/ui/index_spec.rb +0 -2
- data/spec/integration/ui/matrix_spec.rb +0 -1
- data/spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb +2 -2
- data/spec/lib/pact_broker/api/contracts/{verifiable_pacts_json_query_schema_combinations_spec.rb → pacts_for_verification_json_query_schema_combinations_spec.rb} +6 -6
- data/spec/lib/pact_broker/api/contracts/{verifiable_pacts_json_query_schema_spec.rb → pacts_for_verification_json_query_schema_spec.rb} +3 -3
- data/spec/lib/pact_broker/api/contracts/{verifiable_pacts_query_schema_spec.rb → pacts_for_verification_query_string_schema_spec.rb} +3 -3
- data/spec/lib/pact_broker/api/decorators/dashboard_decorator_spec.rb +7 -7
- data/spec/lib/pact_broker/api/decorators/matrix_decorator_spec.rb +19 -4
- data/spec/lib/pact_broker/api/decorators/{verifiable_pacts_query_decorator_spec.rb → pacts_for_verification_query_decorator_spec.rb} +3 -3
- data/spec/lib/pact_broker/api/decorators/reason_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/decorators/verification_summary_decorator_spec.rb +2 -0
- data/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb +7 -3
- data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/middleware/configuration_spec.rb +43 -0
- data/spec/lib/pact_broker/api/resources/verifications_spec.rb +6 -4
- data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +1 -1
- data/spec/lib/pact_broker/badges/service_spec.rb +22 -0
- data/spec/lib/pact_broker/contracts/service_spec.rb +24 -3
- data/spec/lib/pact_broker/db/clean_spec.rb +2 -2
- data/spec/lib/pact_broker/db/data_migrations/create_branches_spec.rb +57 -0
- data/spec/lib/pact_broker/diagnostic/resources/dependencies_spec.rb +4 -4
- data/spec/lib/pact_broker/diagnostic/resources/heartbeat_spec.rb +3 -4
- data/spec/lib/pact_broker/domain/index_item_spec.rb +1 -1
- data/spec/lib/pact_broker/domain/version_spec.rb +127 -36
- data/spec/lib/pact_broker/domain/webhook_request_spec.rb +2 -1
- data/spec/lib/pact_broker/domain/webhook_spec.rb +15 -5
- data/spec/lib/pact_broker/index/service_spec.rb +1 -5
- data/spec/lib/pact_broker/index/service_view_spec.rb +144 -0
- data/spec/lib/pact_broker/matrix/service_spec.rb +10 -1
- data/spec/lib/pact_broker/metrics/service_spec.rb +4 -1
- data/spec/lib/pact_broker/pacts/metadata_spec.rb +11 -3
- data/spec/lib/pact_broker/pacts/pact_publication_dataset_module_spec.rb +109 -10
- data/spec/lib/pact_broker/pacts/pact_publication_latest_verification_spec.rb +29 -0
- data/spec/lib/pact_broker/pacts/pact_publication_selector_dataset_module_spec.rb +3 -2
- data/spec/lib/pact_broker/pacts/pact_publication_spec.rb +5 -5
- data/spec/lib/pact_broker/pacts/repository_find_for_currently_deployed_spec.rb +2 -2
- data/spec/lib/pact_broker/pacts/repository_find_for_currently_supported_releases_spec.rb +2 -2
- data/spec/lib/pact_broker/pacts/repository_spec.rb +15 -2
- data/spec/lib/pact_broker/pacts/selector_spec.rb +45 -3
- data/spec/lib/pact_broker/pacts/service_spec.rb +61 -0
- data/spec/lib/pact_broker/pacts/verifiable_pact_messages_spec.rb +5 -5
- data/spec/lib/pact_broker/relationships/groupify_spec.rb +0 -5
- data/spec/lib/pact_broker/ui/view_models/index_item_spec.rb +21 -6
- data/spec/lib/pact_broker/verifications/pseudo_branch_status_spec.rb +9 -1
- data/spec/lib/pact_broker/verifications/repository_spec.rb +39 -30
- data/spec/lib/pact_broker/verifications/service_spec.rb +9 -5
- data/spec/lib/pact_broker/versions/branch_service_spec.rb +71 -0
- data/spec/lib/pact_broker/versions/branch_version_repository_spec.rb +81 -0
- data/spec/lib/pact_broker/versions/branch_version_spec.rb +27 -0
- data/spec/lib/pact_broker/versions/repository_spec.rb +91 -6
- data/spec/lib/pact_broker/versions/service_spec.rb +4 -3
- data/spec/lib/pact_broker/webhooks/job_spec.rb +4 -4
- data/spec/lib/pact_broker/webhooks/render_spec.rb +6 -0
- data/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +9 -5
- data/spec/lib/pact_broker/webhooks/webhook_request_logger_spec.rb +6 -12
- data/spec/lib/pact_broker/webhooks/webhook_request_template_spec.rb +3 -2
- data/spec/lib/sequel/plugins/upsert_spec.rb +11 -5
- data/spec/migrations/44_add_provider_version_to_verification_spec.rb +6 -9
- data/spec/service_consumers/pact_helper.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/generated_markdown.md +3 -3
- metadata +90 -17
- data/lib/pact_broker/versions/lazy_loaders.rb +0 -13
- data/spec/lib/pact_broker/api/resources/webhook_execution_result_spec.rb +0 -56
@@ -0,0 +1,12 @@
|
|
1
|
+
describe "Get a branch version" do
|
2
|
+
before do
|
3
|
+
td.create_consumer("Foo")
|
4
|
+
.create_consumer_version("1234", branch: "main")
|
5
|
+
end
|
6
|
+
let(:path) { PactBroker::Api::PactBrokerUrls.branch_version_url(PactBroker::Versions::BranchVersion.first) }
|
7
|
+
let(:headers) { { "CONTENT_TYPE" => "application/json" } }
|
8
|
+
|
9
|
+
subject { get(path, {}, headers) }
|
10
|
+
|
11
|
+
it { is_expected.to be_a_hal_json_success_response }
|
12
|
+
end
|
@@ -28,49 +28,9 @@ describe "Updating a pacticipant version" do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "does not overwrites any properties that weren't specified" do
|
31
|
-
expect(response_body[:branch]).to eq "original-branch"
|
32
31
|
expect(response_body[:buildUrl]).to eq "new-build-url"
|
33
32
|
end
|
34
33
|
|
35
|
-
context "when the same not null branch is specified" do
|
36
|
-
let(:version_hash) { { branch: "original-branch" } }
|
37
|
-
|
38
|
-
its(:status) { is_expected.to eq 200 }
|
39
|
-
end
|
40
|
-
|
41
|
-
context "when the existing version has a branch, and the new branch is different", skip: true do
|
42
|
-
let(:version_hash) { { branch: "new-branch" } }
|
43
|
-
|
44
|
-
its(:status) { is_expected.to eq 409 }
|
45
|
-
|
46
|
-
it "returns an error" do
|
47
|
-
expect(response_body[:errors][:branch].first).to include "cannot be changed"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "when the existing version has a branch, and the new branch is nil", skip: true do
|
52
|
-
let(:version_hash) { { branch: nil } }
|
53
|
-
|
54
|
-
its(:status) { is_expected.to eq 409 }
|
55
|
-
|
56
|
-
it "returns an error" do
|
57
|
-
expect(response_body[:errors][:branch].first).to include "cannot be changed"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "when the existing version does not have a branch, and the new branch is specified" do
|
62
|
-
let(:original_branch) { nil }
|
63
|
-
|
64
|
-
its(:status) { is_expected.to eq 200 }
|
65
|
-
end
|
66
|
-
|
67
|
-
context "when the existing version does not have a branch, and the new branch is also nil" do
|
68
|
-
let(:original_branch) { nil }
|
69
|
-
let(:version_hash) { { branch: nil } }
|
70
|
-
|
71
|
-
its(:status) { is_expected.to eq 200 }
|
72
|
-
end
|
73
|
-
|
74
34
|
context "when no tags are specified" do
|
75
35
|
it "does not change the tags" do
|
76
36
|
expect { subject }.to_not change { PactBroker::Domain::Version.for("Foo", "1234").tags }
|
@@ -117,21 +77,6 @@ describe "Updating a pacticipant version" do
|
|
117
77
|
.create_consumer_version_tag("dev")
|
118
78
|
end
|
119
79
|
|
120
|
-
context "when the branch is attempted to be changed", skip: true do
|
121
|
-
let(:version_hash) { { branch: "new-branch" } }
|
122
|
-
|
123
|
-
its(:status) { is_expected.to eq 409 }
|
124
|
-
end
|
125
|
-
|
126
|
-
context "when the branch is not attempted to be changed" do
|
127
|
-
let(:version_hash) { { branch: "original-branch" } }
|
128
|
-
|
129
|
-
it "overwrites the direct properties and blanks out any unprovided ones" do
|
130
|
-
expect(response_body[:branch]).to eq "original-branch"
|
131
|
-
expect(response_body).to_not have_key(:buildUrl)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
80
|
context "when no tags are specified" do
|
136
81
|
it "does not change the tags" do
|
137
82
|
expect { subject }.to_not change { PactBroker::Domain::Version.for("Foo", "1234").tags }
|
@@ -3,6 +3,9 @@
|
|
3
3
|
{
|
4
4
|
"resource_class_name": "PactBroker::Api::Resources::AllWebhooks"
|
5
5
|
},
|
6
|
+
{
|
7
|
+
"resource_class_name": "PactBroker::Api::Resources::BranchVersion"
|
8
|
+
},
|
6
9
|
{
|
7
10
|
"resource_class_name": "PactBroker::Api::Resources::Clean"
|
8
11
|
},
|
@@ -46,6 +49,10 @@
|
|
46
49
|
"resource_class_name": "PactBroker::Api::Resources::PactVersions",
|
47
50
|
"resource_class_data": "consumer"
|
48
51
|
},
|
52
|
+
{
|
53
|
+
"resource_class_name": "PactBroker::Api::Resources::PactVersionsForBranch",
|
54
|
+
"resource_class_data": "consumer"
|
55
|
+
},
|
49
56
|
{
|
50
57
|
"resource_class_name": "PactBroker::Api::Resources::PactWebhooks"
|
51
58
|
},
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"status": 200,
|
31
31
|
"headers": {
|
32
32
|
"Content-Type": "application/hal+json;charset=utf-8",
|
33
|
-
"Content-Length": "
|
33
|
+
"Content-Length": "2976"
|
34
34
|
},
|
35
35
|
"body": {
|
36
36
|
"logs": [
|
@@ -111,7 +111,6 @@
|
|
111
111
|
},
|
112
112
|
"version": {
|
113
113
|
"number": "1",
|
114
|
-
"branch": "main",
|
115
114
|
"buildUrl": "http://ci/builds/1234",
|
116
115
|
"_links": {
|
117
116
|
"self": {
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"status": 200,
|
31
31
|
"headers": {
|
32
32
|
"Content-Type": "application/hal+json;charset=utf-8",
|
33
|
-
"Content-Length": "
|
33
|
+
"Content-Length": "2956"
|
34
34
|
},
|
35
35
|
"body": {
|
36
36
|
"logs": [
|
@@ -111,7 +111,6 @@
|
|
111
111
|
},
|
112
112
|
"version": {
|
113
113
|
"number": "1",
|
114
|
-
"branch": "main",
|
115
114
|
"buildUrl": "http://ci/builds/1234",
|
116
115
|
"_links": {
|
117
116
|
"self": {
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"status": 200,
|
31
31
|
"headers": {
|
32
32
|
"Content-Type": "application/hal+json;charset=utf-8",
|
33
|
-
"Content-Length": "
|
33
|
+
"Content-Length": "2913"
|
34
34
|
},
|
35
35
|
"body": {
|
36
36
|
"logs": [
|
@@ -102,7 +102,6 @@
|
|
102
102
|
},
|
103
103
|
"version": {
|
104
104
|
"number": "1",
|
105
|
-
"branch": "main",
|
106
105
|
"buildUrl": "http://ci/builds/1234",
|
107
106
|
"_links": {
|
108
107
|
"self": {
|
@@ -21,7 +21,8 @@
|
|
21
21
|
}
|
22
22
|
},
|
23
23
|
"number": "1",
|
24
|
-
"branch": "main"
|
24
|
+
"branch": "main",
|
25
|
+
"headBranchNames": ["main"]
|
25
26
|
}
|
26
27
|
},
|
27
28
|
"latestVerificationResult": {
|
@@ -75,7 +76,8 @@
|
|
75
76
|
"name": "Bar",
|
76
77
|
"version": {
|
77
78
|
"number": "2",
|
78
|
-
"branch": "main"
|
79
|
+
"branch": "main",
|
80
|
+
"headBranchNames": ["main"]
|
79
81
|
}
|
80
82
|
},
|
81
83
|
"verificationStatus": "wiffle",
|
@@ -9,6 +9,7 @@ module PactBroker
|
|
9
9
|
end
|
10
10
|
|
11
11
|
let(:hal_browser_enabled) { true }
|
12
|
+
let(:network_url) { "/pacticipants/Some%20Consumer/network" }
|
12
13
|
let(:group_url) { "/groups/Some%20Consumer" }
|
13
14
|
let(:enable_diagnostic_endpoints) { false }
|
14
15
|
|
@@ -52,13 +53,12 @@ module PactBroker
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
55
|
-
describe "a request for /
|
56
|
-
let(:path) { "/
|
56
|
+
describe "a request for /pacticipants/:pacticipant_name" do
|
57
|
+
let(:path) { "/pacticipants/Some%20Consumer" }
|
57
58
|
|
58
59
|
it "returns the group page" do
|
59
60
|
expect(subject.status).to eq 200
|
60
61
|
expect(subject.headers["Content-Type"]).to include "text/html"
|
61
|
-
expect(subject.body).to include "Network graph"
|
62
62
|
expect(subject.body).to include "Some Consumer"
|
63
63
|
end
|
64
64
|
|
@@ -79,12 +79,12 @@ module PactBroker
|
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "a request the group containing a pacticipant" do
|
82
|
-
let(:path) {
|
82
|
+
let(:path) { network_url }
|
83
83
|
|
84
|
-
it "returns the HTML representation of the
|
84
|
+
it "returns the HTML representation of the pacticipant" do
|
85
85
|
expect(subject.status).to eq 200
|
86
86
|
expect(subject.headers["Content-Type"]).to include "text/html"
|
87
|
-
expect(subject.body).to include "Network
|
87
|
+
expect(subject.body).to include "Network Graph"
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -27,8 +27,8 @@ module Pact
|
|
27
27
|
let(:consumer_contract) { Pact::ConsumerContract.from_uri "./spec/support/markdown_pact_with_markdown_chars_in_names.json" }
|
28
28
|
|
29
29
|
it "escapes the markdown characters" do
|
30
|
-
expect(subject.call).to include '
|
31
|
-
expect(subject.call).to include '
|
30
|
+
expect(subject.call).to include '# A pact between Some\*Consumer\*App and Some\_Provider\_App'
|
31
|
+
expect(subject.call).to include '### Requests from Some\*Consumer\*App to Some\_Provider\_App'
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require "pact_broker/api/contracts/
|
1
|
+
require "pact_broker/api/contracts/pacts_for_verification_json_query_schema"
|
2
2
|
|
3
3
|
module PactBroker
|
4
4
|
module Api
|
5
5
|
module Contracts
|
6
|
-
describe
|
6
|
+
describe PactsForVerificationJSONQuerySchema do
|
7
7
|
ALL_PROPERTIES = {
|
8
8
|
mainBranch: true,
|
9
9
|
tag: "tag",
|
@@ -46,7 +46,7 @@ module PactBroker
|
|
46
46
|
|
47
47
|
it "is valid" do
|
48
48
|
params = { consumerVersionSelectors: [selector] }
|
49
|
-
expect(
|
49
|
+
expect(PactsForVerificationJSONQuerySchema.(params)).to be_empty
|
50
50
|
end
|
51
51
|
|
52
52
|
extra_keys = ALL_PROPERTIES.keys - valid_key_combination - [:consumer]
|
@@ -58,11 +58,11 @@ module PactBroker
|
|
58
58
|
describe "with #{selector_with_extra_key}" do
|
59
59
|
if expect_to_be_valid
|
60
60
|
it "is valid" do
|
61
|
-
expect(
|
61
|
+
expect(PactsForVerificationJSONQuerySchema.(params)).to be_empty
|
62
62
|
end
|
63
63
|
else
|
64
64
|
it "is not valid" do
|
65
|
-
expect(
|
65
|
+
expect(PactsForVerificationJSONQuerySchema.(params)).to_not be_empty
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -73,7 +73,7 @@ module PactBroker
|
|
73
73
|
it "is valid" do
|
74
74
|
params = { consumerVersionSelectors: [selector_with_consumer] }
|
75
75
|
|
76
|
-
expect(
|
76
|
+
expect(PactsForVerificationJSONQuerySchema.(params).empty?).to be true
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require "pact_broker/api/contracts/
|
1
|
+
require "pact_broker/api/contracts/pacts_for_verification_json_query_schema"
|
2
2
|
|
3
3
|
module PactBroker
|
4
4
|
module Api
|
5
5
|
module Contracts
|
6
|
-
describe
|
6
|
+
describe PactsForVerificationJSONQuerySchema do
|
7
7
|
before do
|
8
8
|
allow(PactBroker::Deployments::EnvironmentService).to receive(:find_by_name).and_return(environment)
|
9
9
|
end
|
@@ -25,7 +25,7 @@ module PactBroker
|
|
25
25
|
}]
|
26
26
|
end
|
27
27
|
|
28
|
-
subject {
|
28
|
+
subject { PactsForVerificationJSONQuerySchema.(params) }
|
29
29
|
|
30
30
|
context "when the params are valid" do
|
31
31
|
it "has no errors" do
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require "pact_broker/api/contracts/
|
1
|
+
require "pact_broker/api/contracts/pacts_for_verification_query_string_schema"
|
2
2
|
|
3
3
|
module PactBroker
|
4
4
|
module Api
|
5
5
|
module Contracts
|
6
|
-
describe
|
6
|
+
describe PactsForVerificationQueryStringSchema do
|
7
7
|
let(:params) do
|
8
8
|
{
|
9
9
|
provider_version_tags: provider_version_tags,
|
@@ -20,7 +20,7 @@ module PactBroker
|
|
20
20
|
}]
|
21
21
|
end
|
22
22
|
|
23
|
-
subject {
|
23
|
+
subject { PactsForVerificationQueryStringSchema.(params) }
|
24
24
|
|
25
25
|
context "when the params are valid" do
|
26
26
|
it "has no errors" do
|
@@ -21,9 +21,9 @@ module PactBroker
|
|
21
21
|
webhook_status: "blah",
|
22
22
|
pseudo_branch_verification_status: "wiffle",
|
23
23
|
provider_version_number: provider_version.number,
|
24
|
-
|
24
|
+
provider_version_branches: ["main"],
|
25
25
|
consumer_version_number: consumer_version.number,
|
26
|
-
|
26
|
+
consumer_version_branches: ["main"],
|
27
27
|
tag_names: ["prod"],
|
28
28
|
latest_verification_latest_tags: [double("tag", name: "dev", latest?: true)]
|
29
29
|
)
|
@@ -32,8 +32,8 @@ module PactBroker
|
|
32
32
|
let(:provider) { instance_double("PactBroker::Domain::Pacticipant", name: "Bar") }
|
33
33
|
let(:pact) { instance_double("PactBroker::Domain::Pact", created_at: created_at) }
|
34
34
|
let(:verification) { instance_double("PactBroker::Domain::Verification", success: true, created_at: created_at) }
|
35
|
-
let(:consumer_version) { instance_double("PactBroker::Domain::Version", number: "1", pacticipant: consumer
|
36
|
-
let(:provider_version) { instance_double("PactBroker::Domain::Version", number: "2", pacticipant: provider
|
35
|
+
let(:consumer_version) { instance_double("PactBroker::Domain::Version", number: "1", pacticipant: consumer) }
|
36
|
+
let(:provider_version) { instance_double("PactBroker::Domain::Version", number: "2", pacticipant: provider) }
|
37
37
|
let(:last_webhook_execution_date) { created_at }
|
38
38
|
let(:base_url) { "http://example.org" }
|
39
39
|
let(:options) { { user_options: { base_url: base_url } } }
|
@@ -67,7 +67,7 @@ module PactBroker
|
|
67
67
|
subject { JSON.parse(dashboard_json) }
|
68
68
|
|
69
69
|
it "creates some json" do
|
70
|
-
expect(subject).to match_pact(expected_hash, {allow_unexpected_keys: false})
|
70
|
+
expect(subject).to match_pact(expected_hash, { allow_unexpected_keys: false })
|
71
71
|
end
|
72
72
|
|
73
73
|
context "when the pact has never been verified" do
|
@@ -76,7 +76,7 @@ module PactBroker
|
|
76
76
|
it "has a null last verification and provider version" do
|
77
77
|
expected_hash["items"][0]["latestVerificationResult"] = nil
|
78
78
|
expected_hash["items"][0]["provider"]["version"] = nil
|
79
|
-
expect(subject).to match_pact(expected_hash, {allow_unexpected_keys: false})
|
79
|
+
expect(subject).to match_pact(expected_hash, { allow_unexpected_keys: false })
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -85,7 +85,7 @@ module PactBroker
|
|
85
85
|
|
86
86
|
it "has a null latestWebhookExecution" do
|
87
87
|
expected_hash["items"][0]["latestWebhookExecution"] = nil
|
88
|
-
expect(subject).to match_pact(expected_hash, {allow_unexpected_keys: false})
|
88
|
+
expect(subject).to match_pact(expected_hash, { allow_unexpected_keys: false })
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -10,6 +10,7 @@ module PactBroker
|
|
10
10
|
describe "to_json" do
|
11
11
|
before do
|
12
12
|
allow_any_instance_of(ReasonDecorator).to receive(:to_s).and_return("foo")
|
13
|
+
allow_any_instance_of(PactBroker::Api::PactBrokerUrls).to receive(:branch_version_url).and_return("branch_version_url")
|
13
14
|
end
|
14
15
|
let(:verification_date) { DateTime.new(2017, 12, 31) }
|
15
16
|
let(:pact_created_at) { DateTime.new(2017, 1, 1) }
|
@@ -20,13 +21,13 @@ module PactBroker
|
|
20
21
|
{
|
21
22
|
consumer_name: "Consumer",
|
22
23
|
consumer_version_number: "1.0.0",
|
23
|
-
|
24
|
+
consumer_version_branch_versions: consumer_version_branch_versions,
|
24
25
|
consumer_version_tags: consumer_version_tags,
|
25
26
|
provider_version_tags: provider_version_tags,
|
26
27
|
pact_version_sha: "1234",
|
27
28
|
pact_created_at: pact_created_at,
|
28
29
|
provider_version_number: "4.5.6",
|
29
|
-
|
30
|
+
provider_version_branch_versions: provider_version_branch_versions,
|
30
31
|
provider_name: "Provider",
|
31
32
|
success: row_1_success,
|
32
33
|
verification_number: 1,
|
@@ -40,12 +41,12 @@ module PactBroker
|
|
40
41
|
{
|
41
42
|
consumer_name: "Consumer",
|
42
43
|
consumer_version_number: "1.0.0",
|
43
|
-
|
44
|
+
consumer_version_branch_versions: [],
|
44
45
|
consumer_version_tags: [],
|
45
46
|
pact_version_sha: "1234",
|
46
47
|
pact_created_at: pact_created_at,
|
47
48
|
provider_version_number: nil,
|
48
|
-
|
49
|
+
provider_version_branch_versions: [],
|
49
50
|
provider_name: "Provider",
|
50
51
|
success: row_2_success,
|
51
52
|
verification_number: nil,
|
@@ -65,6 +66,12 @@ module PactBroker
|
|
65
66
|
version: {
|
66
67
|
number: "1.0.0",
|
67
68
|
branch: "main",
|
69
|
+
branches: [
|
70
|
+
name: "main",
|
71
|
+
_links: {
|
72
|
+
|
73
|
+
}
|
74
|
+
],
|
68
75
|
_links: {
|
69
76
|
self: {
|
70
77
|
href: "http://example.org/pacticipants/Consumer/versions/1.0.0"
|
@@ -141,6 +148,10 @@ module PactBroker
|
|
141
148
|
|
142
149
|
let(:consumer_version) { double("consumer version", number: "1.0.0", pacticipant: double("consumer", name: "Consumer")) }
|
143
150
|
|
151
|
+
let(:consumer_version_branch_versions) do
|
152
|
+
[ instance_double("PactBroker::Versions::BranchVersion", branch_name: "main", latest?: true) ]
|
153
|
+
end
|
154
|
+
|
144
155
|
let(:consumer_version_tags) do
|
145
156
|
[
|
146
157
|
double("tag", name: "prod", latest?: true, version: consumer_version, created_at: DateTime.now )
|
@@ -149,6 +160,10 @@ module PactBroker
|
|
149
160
|
|
150
161
|
let(:provider_version) { double("provider version", number: "4.5.6", pacticipant: double("provider", name: "Provider")) }
|
151
162
|
|
163
|
+
let(:provider_version_branch_versions) do
|
164
|
+
[ instance_double("PactBroker::Versions::BranchVersion", branch_name: "feat/x", latest?: true) ]
|
165
|
+
end
|
166
|
+
|
152
167
|
let(:provider_version_tags) do
|
153
168
|
[
|
154
169
|
double("tag", name: "master", latest?: false, version: provider_version, created_at: DateTime.now)
|