Sha256: e692da45a9e016a883e07bbe254b3efdfa84024cc9b4d1a8f42ced74d7e59b76

Contents?: true

Size: 1.05 KB

Versions: 44

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8
require "spec_helper"

# use a dummy NOOP output to test Outputs::Base
class LogStash::Outputs::NOOP < LogStash::Outputs::Base
  config_name "noop"
  milestone 2

  config :dummy_option, :validate => :string

  def register; end

  def receive(event)
    return output?(event)
  end
end

class LogStash::Outputs::NOOPLegacyNoWorkers < ::LogStash::Outputs::Base
  LEGACY_WORKERS_NOT_SUPPORTED_REASON = "legacy reason"

  def register
    workers_not_supported(LEGACY_WORKERS_NOT_SUPPORTED_REASON)
  end
end

describe "LogStash::Outputs::Base#new" do
  it "should instantiate cleanly" do
    params = { "dummy_option" => "potatoes", "codec" => "json", "workers" => 2 }
    worker_params = params.dup; worker_params["workers"] = 1

    expect do
      LogStash::Outputs::NOOP.new(params.dup)
    end.not_to raise_error
  end

  it "should move workers_not_supported declarations up to the class level" do
    LogStash::Outputs::NOOPLegacyNoWorkers.new.register
    expect(LogStash::Outputs::NOOPLegacyNoWorkers.workers_not_supported?).to eql(true)
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
logstash-core-5.0.0.alpha2.snapshot1-java spec/logstash/outputs/base_spec.rb
logstash-core-2.3.2-java spec/logstash/outputs/base_spec.rb
logstash-core-2.3.2.snapshot1-java spec/logstash/outputs/base_spec.rb
logstash-core-2.2.4-java spec/logstash/outputs/base_spec.rb
logstash-core-2.3.1-java spec/logstash/outputs/base_spec.rb
logstash-core-2.2.4.snapshot2-java spec/logstash/outputs/base_spec.rb
logstash-core-2.2.4.snapshot1 spec/logstash/outputs/base_spec.rb
logstash-core-2.3.1.snapshot1-java spec/logstash/outputs/base_spec.rb
logstash-core-5.0.0.alpha1-java spec/logstash/outputs/base_spec.rb
logstash-core-5.0.0.alpha1.snapshot2-java spec/logstash/outputs/base_spec.rb
logstash-core-5.0.0.alpha1.snapshot1-java spec/logstash/outputs/base_spec.rb
logstash-core-2.2.3-java spec/logstash/outputs/base_spec.rb
logstash-core-2.3.0-java spec/logstash/outputs/base_spec.rb
logstash-core-2.3.0.snapshot5-java spec/logstash/outputs/base_spec.rb
logstash-core-2.2.3.snapshot2-java spec/logstash/outputs/base_spec.rb
logstash-core-2.3.0.snapshot4-java spec/logstash/outputs/base_spec.rb
logstash-core-2.3.0.snapshot3-java spec/logstash/outputs/base_spec.rb
logstash-core-2.3.0.snapshot1-java spec/logstash/outputs/base_spec.rb
logstash-core-2.2.2-java spec/logstash/outputs/base_spec.rb
logstash-core-2.2.1-java spec/logstash/outputs/base_spec.rb