From e43974cac260561f805d41798fd23ece107dfd33 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Fri, 18 Mar 2022 16:22:13 +1100 Subject: [PATCH] fix(can-i-deploy): allow new provider to be introduced to existing consumer without can-i-deploy having circular dependency issues --- lib/pact_broker/matrix/repository.rb | 7 ++----- .../approvals/matrix_integration_spec.approved.json | 4 ++-- spec/lib/pact_broker/matrix/integration_spec.rb | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/pact_broker/matrix/repository.rb b/lib/pact_broker/matrix/repository.rb index 8348ed3b7..41ba531a9 100644 --- a/lib/pact_broker/matrix/repository.rb +++ b/lib/pact_broker/matrix/repository.rb @@ -118,7 +118,7 @@ def integrations_where_specified_selector_is_consumer(resolved_specified_selecto consumer_name: integration[:consumer_name], provider_id: integration[:provider_id], provider_name: integration[:provider_name], - required: true + required: true # synchronous consumer requires the provider to be present ) end end @@ -130,16 +130,13 @@ def integrations_where_specified_selector_is_provider(resolved_specified_selecto .eager(:consumer, :provider) .all - destination_selector = PactBroker::Matrix::UnresolvedSelector.new(options.slice(:latest, :tag, :branch, :environment_name).compact) - required = PactBroker::Domain::Version.for_selector(destination_selector).pacticipants_set - integrations_involving_specified_providers.collect do | integration | Integration.from_hash( consumer_id: integration.consumer.id, consumer_name: integration.consumer.name, provider_id: integration.provider.id, provider_name: integration.provider.name, - required: required.member?(integration.consumer.id) + required: false # synchronous provider does not require the consumer to be present ) end end diff --git a/spec/fixtures/approvals/matrix_integration_spec.approved.json b/spec/fixtures/approvals/matrix_integration_spec.approved.json index c1fca9b02..601a8bceb 100644 --- a/spec/fixtures/approvals/matrix_integration_spec.approved.json +++ b/spec/fixtures/approvals/matrix_integration_spec.approved.json @@ -177,9 +177,9 @@ ] }, "PactBroker::Matrix::Service find when adding a new provider p2 v1 is allowed to be deployed because the version of c1 that is in test does not care about p2": { - "deployable": null, + "deployable": true, "reasons": [ - "PactBroker::Matrix::PactNotVerifiedByRequiredProviderVersion" + "PactBroker::Matrix::NoDependenciesMissing" ] } } diff --git a/spec/lib/pact_broker/matrix/integration_spec.rb b/spec/lib/pact_broker/matrix/integration_spec.rb index 53e629662..6a9d49dde 100644 --- a/spec/lib/pact_broker/matrix/integration_spec.rb +++ b/spec/lib/pact_broker/matrix/integration_spec.rb @@ -536,7 +536,7 @@ module Matrix ] end - it "is allowed to be deployed because the version of c1 that is in test does not care about p2", pending: true do + it "is allowed to be deployed because the version of c1 that is in test does not care about p2" do expect(subject.deployment_status_summary).to be_deployable end end