Skip to content

Commit

Permalink
add an input helper to run without the need of a config and only from…
Browse files Browse the repository at this point in the history
… the plugin object

Fixes #40
  • Loading branch information
Pere Urbon-Bayes authored and jordansissel committed Oct 8, 2015
1 parent bea9989 commit 4fc0505
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/logstash/devutils/rspec/logstash_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ def output_func(event)
result
end # def input

def plugin_input(plugin, &block)
queue = Queue.new

input_thread = Thread.new do
plugin.run(queue)
end
result = block.call(queue)

plugin.do_stop
input_thread.join
result
end

def agent(&block)

it("agent(#{caller[0].gsub(/ .*/, "")}) runs") do
Expand Down

0 comments on commit 4fc0505

Please sign in to comment.