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

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/instrument/periodic_poller/base_spec.rb