Sha256: 603628834cc4abeea1893e9d3171ad51f6ac0d966aa99af950af5411b06003cb

Contents?: true

Size: 1.75 KB

Versions: 77

Compression:

Stored size: 1.75 KB

Contents

# encoding: utf-8
require "spec_helper"
require "logstash/pipeline"
require "logstash/pipeline_reporter"
require_relative "../support/mocks_classes"

#TODO: Figure out how to add more tests that actually cover inflight events
#This will require some janky multithreading stuff
describe LogStash::PipelineReporter do
  let(:generator_count) { 5 }
  let(:config) do
    "input { generator { count => #{generator_count} } } output { dummyoutput {} } "
  end
  let(:pipeline) { LogStash::Pipeline.new(config)}
  let(:reporter) { pipeline.reporter }

  before do
    allow(LogStash::Plugin).to receive(:lookup).with("output", "dummyoutput").and_return(::LogStash::Outputs::DummyOutput)
    allow(LogStash::Plugin).to receive(:lookup).with("input", "generator").and_call_original
    allow(LogStash::Plugin).to receive(:lookup).with("codec", "plain").and_call_original

    @pre_snapshot = reporter.snapshot
    
    pipeline.run
    @post_snapshot = reporter.snapshot
  end

  after do
    pipeline.shutdown
  end

  describe "events filtered" do
    it "should start at zero" do
      expect(@pre_snapshot.events_filtered).to eql(0)
    end

    it "should end at the number of generated events" do
      expect(@post_snapshot.events_filtered).to eql(generator_count)
    end
  end

  describe "events consumed" do
    it "should start at zero" do
      expect(@pre_snapshot.events_consumed).to eql(0)
    end

    it "should end at the number of generated events" do
      expect(@post_snapshot.events_consumed).to eql(generator_count)
    end
  end

  describe "inflight count" do
    it "should be zero before running" do
      expect(@pre_snapshot.inflight_count).to eql(0)
    end

    it "should be zero after running" do
      expect(@post_snapshot.inflight_count).to eql(0)
    end
  end
end

Version data entries

77 entries across 74 versions & 8 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/pipeline_reporter_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb