Skip to content

Commit

Permalink
fix(can-i-deploy): allow new provider to be introduced to existing co…
Browse files Browse the repository at this point in the history
…nsumer without can-i-deploy having circular dependency issues
  • Loading branch information
bethesque committed Mar 18, 2022
1 parent 145dea9 commit e43974c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions lib/pact_broker/matrix/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/fixtures/approvals/matrix_integration_spec.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
2 changes: 1 addition & 1 deletion spec/lib/pact_broker/matrix/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e43974c

Please sign in to comment.