mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
test and fix for LOGSTASH-2288
This commit is contained in:
parent
9c16d78a66
commit
01e9f37591
2 changed files with 27 additions and 5 deletions
|
@ -74,10 +74,7 @@ module LogStash; module Config; module AST
|
|||
# defines @filter_func and @output_func
|
||||
|
||||
definitions << "@#{type}_func = lambda do |event, &block|"
|
||||
if type == "filter"
|
||||
definitions << " events = [event]"
|
||||
end
|
||||
|
||||
definitions << " events = [event]"
|
||||
definitions << " @logger.debug? && @logger.debug(\"#{type} received\", :event => event.to_hash)"
|
||||
sections.select { |s| s.plugin_type.text_value == type }.each do |s|
|
||||
definitions << s.compile.split("\n", -1).map { |e| " #{e}" }
|
||||
|
|
|
@ -21,7 +21,32 @@ module ConditionalFanciness
|
|||
end
|
||||
end
|
||||
|
||||
describe "conditionals" do
|
||||
describe "conditionals in output" do
|
||||
extend LogStash::RSpec
|
||||
extend ConditionalFanciness
|
||||
|
||||
describe "simple" do
|
||||
config <<-CONFIG
|
||||
input {
|
||||
generator {
|
||||
message => '{"foo":{"bar"},"baz": "quux"}'
|
||||
count => 1
|
||||
}
|
||||
}
|
||||
output {
|
||||
if [foo] == "bar" {
|
||||
stdout { }
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
agent do
|
||||
#LOGSTASH-2288, should not fail raising an exception
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "conditionals in filter" do
|
||||
extend LogStash::RSpec
|
||||
extend ConditionalFanciness
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue