add tests for webserver metric

Fixes #6385
This commit is contained in:
Joao Duarte 2016-12-14 14:14:58 +00:00 committed by João Duarte
parent b314800abc
commit a9e474f0e1
2 changed files with 6 additions and 2 deletions

View file

@ -20,7 +20,9 @@ module LogStash
end
def http_address
service.agent.webserver.address
@http_address ||= service.get_shallow(:http_address).value
rescue ::LogStash::Instrument::MetricStore::MetricNotFound, NoMethodError => e
nil
end
end
end

View file

@ -20,7 +20,9 @@ end
module LogStash
class DummyAgent < Agent
def start_webserver
@webserver = Struct.new(:address).new("#{Socket.gethostname}:#{::LogStash::WebServer::DEFAULT_PORTS.first}")
http_address = "#{Socket.gethostname}:#{::LogStash::WebServer::DEFAULT_PORTS.first}"
@webserver = Struct.new(:address).new(http_address)
self.metric.gauge([], :http_address, http_address)
end
def stop_webserver; end
end