Sha256: 7207ae51b211473853b516e8e2f9a5b49e85ed63bfcec03209630bad02ffd74a
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require "test_utils" require "logstash/filters/geoip" describe LogStash::Filters::GeoIP do extend LogStash::RSpec describe "defaults" do config <<-CONFIG filter { geoip { source => "ip" #database => "vendor/geoip/GeoLiteCity.dat" } } CONFIG sample("ip" => "8.8.8.8") do insist { subject }.include?("geoip") expected_fields = %w(ip country_code2 country_code3 country_name continent_code region_name city_name postal_code latitude longitude dma_code area_code timezone location ) expected_fields.each do |f| insist { subject["geoip"] }.include?(f) end end sample("ip" => "127.0.0.1") do # assume geoip fails on localhost lookups reject { subject }.include?("geoip") end end describe "Specify the target" do config <<-CONFIG filter { geoip { source => "ip" #database => "vendor/geoip/GeoLiteCity.dat" target => src_ip } } CONFIG sample("ip" => "8.8.8.8") do insist { subject }.include?("src_ip") expected_fields = %w(ip country_code2 country_code3 country_name continent_code region_name city_name postal_code latitude longitude dma_code area_code timezone location ) expected_fields.each do |f| insist { subject["src_ip"] }.include?(f) end end sample("ip" => "127.0.0.1") do # assume geoip fails on localhost lookups reject { subject }.include?("src_ip") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-lib-1.3.2 | spec/filters/geoip.rb |