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.1.9 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.8 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.6 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-newrelic-1.2.0 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.2.1-java/spec/logstash/pipeline_reporter_spec.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/logstash-core-5.2.1-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb
logstash-core-5.6.16-java spec/logstash/pipeline_reporter_spec.rb
logstash-core-5.6.15-java spec/logstash/pipeline_reporter_spec.rb
logstash-core-5.6.14-java spec/logstash/pipeline_reporter_spec.rb
logstash-core-5.6.13-java spec/logstash/pipeline_reporter_spec.rb
logstash-core-5.6.12-java spec/logstash/pipeline_reporter_spec.rb
logstash-core-5.6.11-java spec/logstash/pipeline_reporter_spec.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/logstash-core-5.6.4-java/spec/logstash/pipeline_reporter_spec.rb