Skip to content

Commit 9fe6446

Browse files
committed
Fix service instance filtering
* include managed service instances, not user-provided service instances
1 parent 644f2a3 commit 9fe6446

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/fetchers/global_usage_summary_fetcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def summary
2727

2828
summary.service_instances = ServiceInstance.
2929
dataset.
30-
where(is_gateway_service: false).
30+
where(is_gateway_service: true).
3131
count
3232

3333
summary.reserved_ports = Route.

spec/unit/fetchers/global_usage_summary_fetcher_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module VCAP::CloudController
2222
let!(:process2) { ProcessModelFactory.make(instances: 5, state: 'STARTED', memory: 100) }
2323
let!(:service_instance1) { ServiceInstance.make(is_gateway_service: false) }
2424
let!(:service_instance2) { ServiceInstance.make(is_gateway_service: true) }
25+
let!(:service_instance3) { ServiceInstance.make(is_gateway_service: true) }
2526
let!(:service_key1) { VCAP::CloudController::ServiceKey.make(service_instance: service_instance1) }
2627
let!(:service_key2) { VCAP::CloudController::ServiceKey.make(service_instance: service_instance2) }
2728
let!(:shared_domain_with_router_group) { SharedDomain.make(router_group_guid: 'rg-123') }
@@ -36,7 +37,7 @@ module VCAP::CloudController
3637
expect(summary.started_instances).to eq(21)
3738
expect(summary.memory_in_mb).to eq(2200)
3839
expect(summary.routes).to eq(2)
39-
expect(summary.service_instances).to eq(1)
40+
expect(summary.service_instances).to eq(2)
4041
expect(summary.reserved_ports).to eq(1)
4142
expect(summary.domains).to eq(2) # system domain "vcap.me" plus :private_domain_without_router_group
4243
expect(summary.per_app_tasks).to eq(1)

0 commit comments

Comments
 (0)