rescope the mock classes

Fixes #6109
This commit is contained in:
Pier-Hugues Pellerin 2016-10-24 09:52:32 -04:00
parent 9ee34a3c6f
commit b1c62da570
2 changed files with 43 additions and 43 deletions

View file

@ -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

View file

@ -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