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?
|
reject { subject }.cancelled?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "multiple match conditions should cancel on failure" do
|
describe "multiple match conditions should cancel on failure" do
|
||||||
config <<-CONFIG
|
config <<-CONFIG
|
||||||
filter {
|
filter {
|
||||||
|
@ -82,7 +82,7 @@ describe LogStash::Filters::Grep do
|
||||||
insist { subject }.cancelled?
|
insist { subject }.cancelled?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "single condition with regexp syntax" do
|
describe "single condition with regexp syntax" do
|
||||||
config <<-CONFIG
|
config <<-CONFIG
|
||||||
filter {
|
filter {
|
||||||
|
@ -110,8 +110,8 @@ describe LogStash::Filters::Grep do
|
||||||
insist { subject }.cancelled?
|
insist { subject }.cancelled?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "adding one field on success" do
|
describe "adding one field on success" do
|
||||||
config <<-CONFIG
|
config <<-CONFIG
|
||||||
filter {
|
filter {
|
||||||
grep {
|
grep {
|
||||||
|
@ -126,7 +126,7 @@ describe LogStash::Filters::Grep do
|
||||||
insist { subject["new_field"]} == ["new_value"]
|
insist { subject["new_field"]} == ["new_value"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "adding one field with a sprintf value" do
|
describe "adding one field with a sprintf value" do
|
||||||
config <<-CONFIG
|
config <<-CONFIG
|
||||||
filter {
|
filter {
|
||||||
|
@ -147,7 +147,7 @@ describe LogStash::Filters::Grep do
|
||||||
# Seems to be multi-match several time on the same field not allowed
|
# 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
|
# 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
|
# Also add_field behaviour tested separately in new NOOP test for add_field
|
||||||
|
|
||||||
# describe "adding fields on successful multiple match" do
|
# describe "adding fields on successful multiple match" do
|
||||||
# config <<-CONFIG
|
# config <<-CONFIG
|
||||||
# filter {
|
# filter {
|
||||||
|
@ -165,7 +165,7 @@ describe LogStash::Filters::Grep do
|
||||||
# insist { subject["new_field"]} == ["new_value", "new_value_2"]
|
# insist { subject["new_field"]} == ["new_value", "new_value_2"]
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
describe "add tags" do
|
describe "add tags" do
|
||||||
config <<-CONFIG
|
config <<-CONFIG
|
||||||
filter {
|
filter {
|
||||||
|
@ -175,14 +175,14 @@ describe LogStash::Filters::Grep do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONFIG
|
CONFIG
|
||||||
|
|
||||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
||||||
reject { subject }.cancelled?
|
reject { subject }.cancelled?
|
||||||
insist { subject.tags} == ["tag", "new_tag"]
|
insist { subject.tags} == ["tag", "new_tag"]
|
||||||
end
|
end
|
||||||
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
|
config <<-CONFIG
|
||||||
filter {
|
filter {
|
||||||
grep {
|
grep {
|
||||||
|
@ -192,7 +192,7 @@ describe LogStash::Filters::Grep do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONFIG
|
CONFIG
|
||||||
|
|
||||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
||||||
reject { subject }.cancelled?
|
reject { subject }.cancelled?
|
||||||
insist { subject.tags} == ["tag", "new_tag"]
|
insist { subject.tags} == ["tag", "new_tag"]
|
||||||
|
@ -209,7 +209,7 @@ describe LogStash::Filters::Grep do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONFIG
|
CONFIG
|
||||||
|
|
||||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => "non-matching"}}) do
|
sample ({"@tags" => ["tag"], "@fields" => {"str" => "non-matching"}}) do
|
||||||
reject { subject }.cancelled?
|
reject { subject }.cancelled?
|
||||||
insist { subject.tags} == ["tag"]
|
insist { subject.tags} == ["tag"]
|
||||||
|
@ -225,13 +225,13 @@ describe LogStash::Filters::Grep do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONFIG
|
CONFIG
|
||||||
|
|
||||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
sample ({"@tags" => ["tag"], "@fields" => {"str" => "test"}}) do
|
||||||
reject { subject }.cancelled?
|
reject { subject }.cancelled?
|
||||||
insist { subject.tags} == ["tag", subject["str"]]
|
insist { subject.tags} == ["tag", subject["str"]]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "negate=true should not cause drops when field is nil" do
|
describe "negate=true should not cause drops when field is nil" do
|
||||||
# Set negate to true; the pattern being searched doesn't actually matter
|
# 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
|
# here. We're testing to make sure "grep -v" behavior doesn't drop events
|
||||||
|
@ -244,7 +244,7 @@ describe LogStash::Filters::Grep do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONFIG
|
CONFIG
|
||||||
|
|
||||||
sample ({"@tags" => ["tag"], "@fields" => {"str" => nil}}) do
|
sample ({"@tags" => ["tag"], "@fields" => {"str" => nil}}) do
|
||||||
reject { subject }.cancelled?
|
reject { subject }.cancelled?
|
||||||
end
|
end
|
||||||
|
@ -261,9 +261,9 @@ describe LogStash::Filters::Grep do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONFIG
|
CONFIG
|
||||||
|
|
||||||
sample ({"@type" => "testing", "@tags" => ["_grokparsefailure"], "@fields" => {"str" => "test"}}) do
|
sample ({"@type" => "testing", "@tags" => ["_grokparsefailure"], "@fields" => {"str" => "test"}}) do
|
||||||
insist { subject }.cancelled?
|
insist { subject }.cancelled?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,17 +6,17 @@ describe LogStash::Filters::NOOP do
|
||||||
extend LogStash::RSpec
|
extend LogStash::RSpec
|
||||||
|
|
||||||
describe "adding multiple value to one field" do
|
describe "adding multiple value to one field" do
|
||||||
config <<-CONFIG
|
config <<-CONFIG
|
||||||
filter {
|
filter {
|
||||||
noop {
|
noop {
|
||||||
add_field => ["new_field", "new_value"]
|
add_field => ["new_field", "new_value"]
|
||||||
add_field => ["new_field", "new_value_2"]
|
add_field => ["new_field", "new_value_2"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONFIG
|
CONFIG
|
||||||
|
|
||||||
sample "" do
|
sample "" do
|
||||||
insist { subject["new_field"]} == ["new_value", "new_value_2"]
|
insist { subject["new_field"]} == ["new_value", "new_value_2"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue