Sha256: a26c79a5d1503688caa6ae75bfefdf81fb91dd60cdd8cc540e9a9eb1c8783b80

Contents?: true

Size: 1.37 KB

Versions: 13

Compression:

Stored size: 1.37 KB

Contents

# encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/filters/geoip"
require_relative 'test_helper'

describe LogStash::Filters::GeoIP do

  describe "database path", :aggregate_failures do
    let(:plugin) { LogStash::Filters::GeoIP.new("source" => "[target][ip]", "database" => DEFAULT_ASN_DB_PATH) }

    before :each do
      logstash_path = ENV['LOGSTASH_PATH'] || '/usr/share/logstash' # docker logstash home
      stub_const('LogStash::Environment::LOGSTASH_HOME', logstash_path)
    end

    context "select_database_path with static path" do
      it "should be the assigned path" do
        expect(plugin.select_database_path).to eql(DEFAULT_ASN_DB_PATH)
      end
    end

    describe ">= 7.14" do
      it "load_database_manager? should be true" do
        expect(plugin.load_database_manager?).to be_truthy
      end
    end if MAJOR >= 8 || (MAJOR == 7 && MINOR >= 14)

    describe "<= 7.13" do
      it "load_database_manager? should be false" do
        expect(plugin.load_database_manager?).to be_falsey
      end

      describe "select_database_path without path setting" do
        let(:plugin) { LogStash::Filters::GeoIP.new("source" => "[target][ip]") }

        it "should be default" do
          expect(plugin.select_database_path).to eql(DEFAULT_CITY_DB_PATH)
        end
      end
    end if MAJOR < 7 || (MAJOR == 7 && MINOR <= 13)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
logstash-filter-geoip-7.2.13-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.12-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.11-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.10-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.9-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.8-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.7-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.6-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.5-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.4-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.3-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.2-java spec/filters/geoip_spec.rb
logstash-filter-geoip-7.2.1-java spec/filters/geoip_spec.rb