mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Now with hopefully better text format
This commit is contained in:
parent
77741d1da3
commit
4001a44c3f
2 changed files with 30 additions and 30 deletions
|
@ -67,7 +67,7 @@ describe LogStash::Filters::Grep do
|
|||
reject { subject }.cancelled?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "multiple match conditions should cancel on failure" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
|
@ -82,7 +82,7 @@ describe LogStash::Filters::Grep do
|
|||
insist { subject }.cancelled?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "single condition with regexp syntax" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
|
@ -110,8 +110,8 @@ describe LogStash::Filters::Grep do
|
|||
insist { subject }.cancelled?
|
||||
end
|
||||
end
|
||||
|
||||
describe "adding one field on success" do
|
||||
|
||||
describe "adding one field on success" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
grep {
|
||||
|
@ -126,7 +126,7 @@ describe LogStash::Filters::Grep do
|
|||
insist { subject["new_field"]} == ["new_value"]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "adding one field with a sprintf value" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
|
@ -147,7 +147,7 @@ describe LogStash::Filters::Grep do
|
|||
# Seems to be multi-match several time on the same field not allowed
|
||||
# maybe a clearer test on multi-match on same field could be created
|
||||
# Also add_field behaviour tested separately in new NOOP test for add_field
|
||||
|
||||
|
||||
# describe "adding fields on successful multiple match" do
|
||||
# config <<-CONFIG
|
||||
# filter {
|
||||
|
@ -165,7 +165,7 @@ describe LogStash::Filters::Grep do
|
|||
# insist { subject["new_field"]} == ["new_value", "new_value_2"]
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
describe "add tags" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
|
@ -175,14 +175,14 @@ describe LogStash::Filters::Grep do
|
|||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
|
||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
||||
reject { subject }.cancelled?
|
||||
insist { subject.tags} == ["tag", "new_tag"]
|
||||
end
|
||||
end
|
||||
|
||||
describe "add tags with drop set to false tags matching events" do
|
||||
|
||||
describe "add tags with drop set to false tags matching events" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
grep {
|
||||
|
@ -192,7 +192,7 @@ describe LogStash::Filters::Grep do
|
|||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
|
||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
||||
reject { subject }.cancelled?
|
||||
insist { subject.tags} == ["tag", "new_tag"]
|
||||
|
@ -209,7 +209,7 @@ describe LogStash::Filters::Grep do
|
|||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
|
||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => "non-matching"}}) do
|
||||
reject { subject }.cancelled?
|
||||
insist { subject.tags} == ["tag"]
|
||||
|
@ -225,13 +225,13 @@ describe LogStash::Filters::Grep do
|
|||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
|
||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
||||
reject { subject }.cancelled?
|
||||
insist { subject.tags} == ["tag", subject["str"]]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "negate=true should not cause drops when field is nil" do
|
||||
# Set negate to true; the pattern being searched doesn't actually matter
|
||||
# here. We're testing to make sure "grep -v" behavior doesn't drop events
|
||||
|
@ -244,7 +244,7 @@ describe LogStash::Filters::Grep do
|
|||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
|
||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => nil}}) do
|
||||
reject { subject }.cancelled?
|
||||
end
|
||||
|
@ -261,9 +261,9 @@ describe LogStash::Filters::Grep do
|
|||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
|
||||
sample ({"@type" => "testing", "@tags" => ["_grokparsefailure"], "@fields" => {"str" => "test"}}) do
|
||||
insist { subject }.cancelled?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,17 +6,17 @@ describe LogStash::Filters::NOOP do
|
|||
extend LogStash::RSpec
|
||||
|
||||
describe "adding multiple value to one field" do
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
noop {
|
||||
add_field => ["new_field", "new_value"]
|
||||
add_field => ["new_field", "new_value_2"]
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
config <<-CONFIG
|
||||
filter {
|
||||
noop {
|
||||
add_field => ["new_field", "new_value"]
|
||||
add_field => ["new_field", "new_value_2"]
|
||||
}
|
||||
}
|
||||
CONFIG
|
||||
|
||||
sample "" do
|
||||
insist { subject["new_field"]} == ["new_value", "new_value_2"]
|
||||
end
|
||||
end
|
||||
end
|
||||
sample "" do
|
||||
insist { subject["new_field"]} == ["new_value", "new_value_2"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue