From c46c88044863ad3f3c3aa70dfcfb063bf358cc07 Mon Sep 17 00:00:00 2001 From: Katharina Przybill <30441792+kathap@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:32:11 +0100 Subject: [PATCH] add test for disabeld statsd metrics --- .../dependency_locator_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/unit/lib/cloud_controller/dependency_locator_spec.rb b/spec/unit/lib/cloud_controller/dependency_locator_spec.rb index e7709c7f7e9..4b872818a92 100644 --- a/spec/unit/lib/cloud_controller/dependency_locator_spec.rb +++ b/spec/unit/lib/cloud_controller/dependency_locator_spec.rb @@ -484,6 +484,24 @@ expect(locator.statsd_client).to eq(expected_client) end + + it 'returns the null statsd client' do + host = 'test-host' + port = 1234 + + TestConfig.override( + statsd_host: host, + statsd_port: port, + disable_statsd_metrics: true + ) + + expected_client = double(CloudController::NullStatsdClient) + + allow(CloudController::NullStatsdClient).to receive(:new). + and_return(expected_client) + + expect(locator.statsd_client).to eq(expected_client) + end end describe '#bbs_stager_client' do