Sha256: 533c2de6beded0b478134583be46df307640f84205aa85870a637030fd1a2117
Contents?: true
Size: 1.69 KB
Versions: 25
Compression:
Stored size: 1.69 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 describe "LogStash::Outputs::Base#worker_setup" do it "should create workers using original parameters except workers = 1" do params = { "dummy_option" => "potatoes", "codec" => "json", "workers" => 2 } worker_params = params.dup; worker_params["workers"] = 1 output = LogStash::Outputs::NOOP.new(params.dup) expect(LogStash::Outputs::NOOP).to receive(:new).twice.with(worker_params).and_call_original output.worker_setup end end describe "LogStash::Outputs::Base#output?" do it "should filter by type" do output = LogStash::Outputs::NOOP.new("type" => "noop") expect(output.receive(LogStash::Event.new({"type" => "noop"}))).to eq(true) expect(output.receive(LogStash::Event.new({"type" => "not_noop"}))).to eq(false) end it "should filter by tags" do output = LogStash::Outputs::NOOP.new("tags" => ["value", "value2"]) expect(output.receive(LogStash::Event.new({"tags" => ["value","value2"]}))).to eq(true) expect(output.receive(LogStash::Event.new({"tags" => ["notvalue"]}))).to eq(false) expect(output.receive(LogStash::Event.new({"tags" => ["value"]}))).to eq(false) end it "should exclude by tags" do output = LogStash::Outputs::NOOP.new("exclude_tags" => ["value"]) expect(output.receive(LogStash::Event.new({"tags" => ["value"]}))).to eq(false) expect(output.receive(LogStash::Event.new({"tags" => ["notvalue"]}))).to eq(true) end end
Version data entries
25 entries across 25 versions & 3 rubygems