Created
February 18, 2015 20:06
-
-
Save anveo/5f201f0ead0e5f30b975 to your computer and use it in GitHub Desktop.
logstash spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ logstash rspec spec.rb | |
Using Accessor#strict_set for specs | |
Run options: exclude {:redis=>true, :socket=>true, :performance=>true, :elasticsearch=>true, :broken=>true, :export_cypher=>true} | |
.. | |
Finished in 0.11 seconds | |
2 examples, 0 failures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "test_utils" | |
describe "dash check" do | |
extend LogStash::RSpec | |
config <<-CONFIG | |
filter { | |
if [@message] =~ /[-]/ { | |
mutate { | |
'add_tag' => ["has_dash"] | |
} | |
} | |
} | |
CONFIG | |
sample({'@message' => 'FOOBAR'}) do | |
insist { subject["tags"] } == nil | |
end | |
sample({'@message' => 'FOO-BAR'}) do | |
insist { subject["tags"].include?("has_dash") } | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment