Sha256: 36229c079dff83b6359244e3888d7b27032f58ab2c29d31452cbfdde543a204d
Contents?: true
Size: 1.19 KB
Versions: 107
Compression:
Stored size: 1.19 KB
Contents
# encoding: utf-8 require "logstash/instrument/periodic_poller/base" require "logstash/instrument/metric" require "logstash/instrument/collector" describe LogStash::Instrument::PeriodicPoller::Base do let(:metric) { LogStash::Instrument::Metric.new(LogStash::Instrument::Collector.new) } let(:options) { {} } subject { described_class.new(metric, options) } describe "#update" do it "logs an timeout exception to debug level" do exception = Concurrent::TimeoutError.new expect(subject.logger).to receive(:debug).with(anything, hash_including(:exception => exception.class)) subject.update(Time.now, "hola", exception) end it "logs any other exception to error level" do exception = Class.new expect(subject.logger).to receive(:error).with(anything, hash_including(:exception => exception.class)) subject.update(Time.now, "hola", exception) end it "doesnt log anything when no exception is received" do exception = Concurrent::TimeoutError.new expect(subject.logger).not_to receive(:debug).with(anything) expect(subject.logger).not_to receive(:error).with(anything) subject.update(Time.now, "hola", exception) end end end
Version data entries
107 entries across 104 versions & 11 rubygems