Skip to content

Commit

Permalink
chore(metrics): query distinct consumer_id/provider_id to determine i…
Browse files Browse the repository at this point in the history
…ntegration count
  • Loading branch information
bethesque committed Dec 21, 2021
1 parent f03ec20 commit 52efbca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pact_broker/metrics/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def metrics
withMainBranchSetCount: PactBroker::Domain::Pacticipant.with_main_branch_set.count
},
integrations: {
count: PactBroker::Integrations::Integration.count
count: PactBroker::Pacts::PactPublication.select(:consumer_id, :provider_id).distinct.count
},
pactPublications: {
count: PactBroker::Pacts::PactPublication.count,
Expand Down
12 changes: 12 additions & 0 deletions spec/lib/pact_broker/metrics/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ module Service
its([:pacticipants, :withMainBranchSetCount]) { is_expected.to eq 1 }
end

describe "integrations" do
before do
td.create_pact_with_hierarchy("Foo", "1", "Bar")
.create_pact_with_hierarchy("Foo", "1", "Bar2")
.create_consumer("NoPactConsumer")
.create_provider("NoPactProvider")
.create_integration
end

its([:integrations, :count]) { is_expected.to eq 2 }
end

describe "pacticipant versions" do
before do
td.create_consumer("Foo")
Expand Down

0 comments on commit 52efbca

Please sign in to comment.