Sha256: 851ccd86ade95bec100e6ecfdde666634c69cabe4189ef87d17a77cd6663cec9

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

require "logstash/devutils/rspec/spec_helper"
require "logstash/filters/tld"

describe LogStash::Filters::Tld do
  describe "Set to TLD" do
    config <<-CONFIG
      filter {
        tld {
        }
      }
    CONFIG

#{
#       "message" => "google.com",
#      "@version" => "1",
#    "@timestamp" => "2015-01-22T17:33:19.669Z",
#          "host" => "homer",
#      "sequence" => 0,
#           "tld" => {
#              "tld" => "com",
#              "sld" => "google",
#              "trd" => nil,
#           "domain" => "google.com",
#        "subdomain" => nil
#    }


    sample("message" => "google.com") do
      insist { subject.get("tld")["tld"] } == "com"
      insist { subject.get("tld")["sld"] } == "google"
      insist { subject.get("tld")["trd"] } == nil
      insist { subject.get("tld")["domain"] } == "google.com"
      insist { subject.get("tld")["subdomain"] } == nil
    end

    sample("message" => "google.co.uk") do
      insist { subject.get("tld")["tld"] } == "co.uk"
      insist { subject.get("tld")["sld"] } == "google"
      insist { subject.get("tld")["trd"] } == nil
      insist { subject.get("tld")["domain"] } == "google.co.uk"
      insist { subject.get("tld")["subdomain"] } == nil
    end

    sample("message" => "www.google.com") do
      insist { subject.get("tld")["tld"] } == "com"
      insist { subject.get("tld")["sld"] } == "google"
      insist { subject.get("tld")["trd"] } == "www"
      insist { subject.get("tld")["domain"] } == "google.com"
      insist { subject.get("tld")["subdomain"] } == "www.google.com"
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logstash-filter-tld-3.1.0 spec/filters/tld_spec.rb
logstash-filter-tld-3.0.3 spec/filters/tld_spec.rb
logstash-filter-tld-3.0.2 spec/filters/tld_spec.rb
logstash-filter-tld-3.0.1 spec/filters/tld_spec.rb
logstash-filter-tld-3.0.0 spec/filters/tld_spec.rb