Skip to content

Commit

Permalink
fix for clock and deployment_updater
Browse files Browse the repository at this point in the history
  • Loading branch information
kathap committed Jan 19, 2024
1 parent 06d4479 commit e72c874
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 4 additions & 7 deletions lib/cloud_controller/dependency_locator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,11 @@ def registry_buddy_client
def statsd_client
if @dependencies[:statsd_client]
@dependencies[:statsd_client]
elsif config.get(:enable_statsd_metrics) == true || config.get(:enable_statsd_metrics).nil?
Statsd.logger = Steno.logger('statsd.client')
register(:statsd_client, Statsd.new(config.get(:statsd_host), config.get(:statsd_port)))
else
config = CloudController::DependencyLocator.instance.config
if config.get(:enable_statsd_metrics) == true
Statsd.logger = Steno.logger('statsd.client')
register(:statsd_client, Statsd.new(config.get(:statsd_host), config.get(:statsd_port)))
else
register(:statsd_client, NullStatsdClient.new)
end
register(:statsd_client, NullStatsdClient.new)
end
end

Expand Down
9 changes: 3 additions & 6 deletions spec/unit/lib/cloud_controller/dependency_locator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,9 @@
expect(locator.statsd_client).to eq(expected_client)
end

it 'returns the null statsd client' do
host = 'test-host'
port = 1234
it 'returns the null statsd client if enable_statsd_metrics is set to false' do

TestConfig.override(
statsd_host: host,
statsd_port: port,
enable_statsd_metrics: false
)

Expand All @@ -509,7 +505,8 @@
TestConfig.context = :deployment_updater
TestConfig.override(
statsd_host: host,
statsd_port: port
statsd_port: port,
enable_statsd_metrics: nil
)

expected_client = double(Statsd)
Expand Down

0 comments on commit e72c874

Please sign in to comment.