mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
parent
9ee34a3c6f
commit
b1c62da570
2 changed files with 43 additions and 43 deletions
|
@ -104,15 +104,15 @@ describe LogStash::Pipeline do
|
|||
describe "event cancellation" do
|
||||
# test harness for https://github.com/elastic/logstash/issues/6055
|
||||
|
||||
let(:output) { DummyOutputWithEventsArray.new }
|
||||
let(:output) { LogStash::Outputs::DummyOutputWithEventsArray.new }
|
||||
|
||||
before do
|
||||
allow(LogStash::Plugin).to receive(:lookup).with("input", "generator").and_return(LogStash::Inputs::Generator)
|
||||
allow(LogStash::Plugin).to receive(:lookup).with("output", "dummyoutputwitheventsarray").and_return(DummyOutputWithEventsArray)
|
||||
allow(LogStash::Plugin).to receive(:lookup).with("output", "dummyoutputwitheventsarray").and_return(LogStash::Outputs::DummyOutputWithEventsArray)
|
||||
allow(LogStash::Plugin).to receive(:lookup).with("filter", "drop").and_call_original
|
||||
allow(LogStash::Plugin).to receive(:lookup).with("filter", "mutate").and_call_original
|
||||
allow(LogStash::Plugin).to receive(:lookup).with("codec", "plain").and_call_original
|
||||
allow(DummyOutputWithEventsArray).to receive(:new).with(any_args).and_return(output)
|
||||
allow(LogStash::Outputs::DummyOutputWithEventsArray).to receive(:new).with(any_args).and_return(output)
|
||||
end
|
||||
|
||||
let(:config) do
|
||||
|
|
|
@ -3,49 +3,49 @@ require "logstash/outputs/base"
|
|||
require "thread"
|
||||
|
||||
module LogStash module Outputs
|
||||
class DummyOutput < LogStash::Outputs::Base
|
||||
config_name "dummyoutput"
|
||||
milestone 2
|
||||
class DummyOutput < LogStash::Outputs::Base
|
||||
config_name "dummyoutput"
|
||||
milestone 2
|
||||
|
||||
attr_reader :num_closes, :events
|
||||
attr_reader :num_closes, :events
|
||||
|
||||
def initialize(params={})
|
||||
super
|
||||
@num_closes = 0
|
||||
@events = Queue.new
|
||||
def initialize(params={})
|
||||
super
|
||||
@num_closes = 0
|
||||
@events = Queue.new
|
||||
end
|
||||
|
||||
def register
|
||||
end
|
||||
|
||||
def receive(event)
|
||||
@events << event
|
||||
end
|
||||
|
||||
def close
|
||||
@num_closes = 1
|
||||
end
|
||||
end
|
||||
|
||||
def register
|
||||
class DummyOutputWithEventsArray < LogStash::Outputs::Base
|
||||
config_name "dummyoutput2"
|
||||
milestone 2
|
||||
|
||||
attr_reader :events
|
||||
|
||||
def initialize(params={})
|
||||
super
|
||||
@events = []
|
||||
end
|
||||
|
||||
def register
|
||||
end
|
||||
|
||||
def receive(event)
|
||||
@events << event
|
||||
end
|
||||
|
||||
def close
|
||||
end
|
||||
end
|
||||
|
||||
def receive(event)
|
||||
@events << event
|
||||
end
|
||||
|
||||
def close
|
||||
@num_closes = 1
|
||||
end
|
||||
end
|
||||
|
||||
class DummyOutputWithEventsArray < LogStash::Outputs::Base
|
||||
config_name "dummyoutput2"
|
||||
milestone 2
|
||||
|
||||
attr_reader :events
|
||||
|
||||
def initialize(params={})
|
||||
super
|
||||
@events = []
|
||||
end
|
||||
|
||||
def register
|
||||
end
|
||||
|
||||
def receive(event)
|
||||
@events << event
|
||||
end
|
||||
|
||||
def close
|
||||
end
|
||||
end
|
||||
end end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue