Sha256: 83527cc78f6a3ae8f301ec4ebac5a8d59e69972c5aaf19a815335dc2e0728fbe

Contents?: true

Size: 1.71 KB

Versions: 49

Compression:

Stored size: 1.71 KB

Contents

# encoding: utf-8
require "logstash/modules/logstash_config"

describe LogStash::Modules::LogStashConfig do
  let(:mod) { instance_double("Modules", :directory => Stud::Temporary.directory, :module_name => "testing") }
  let(:settings) { {"var.logstash.testing.pants" => "fancy" }}
  subject { described_class.new(mod, settings) }

  describe "configured inputs" do
    context "when no inputs is send" do
      it "returns the default" do
        expect(subject.configured_inputs(["kafka"])).to include("kafka")
      end
    end

    context "when inputs are send" do
      let(:settings) { { "var.inputs" => "tcp" } }

      it "returns the configured inputs" do
        expect(subject.configured_inputs(["kafka"])).to include("tcp")
      end

      context "when alias is specified" do
        let(:settings) { { "var.inputs" => "smartconnector" } }

        it "returns the configured inputs" do
          expect(subject.configured_inputs(["kafka"], { "smartconnector" => "tcp"  })).to include("tcp", "smartconnector")
        end
      end
    end
  end

  describe "array to logstash array string" do
    it "return an escaped string" do
      expect(subject.array_to_string(["hello", "ninja"])).to eq("['hello', 'ninja']")
    end
  end

  describe "alias modules options" do
    let(:alias_table) do
      { "var.logstash.testing" => "var.logstash.better" }
    end

    before do
      subject.alias_settings_keys!(alias_table)
    end

    it "allow to retrieve settings" do
      expect(subject.setting("var.logstash.better.pants", "dont-exist")).to eq("fancy")
    end

    it "allow to retrieve settings with the original name" do
      expect(subject.setting("var.logstash.testing.pants", "dont-exist")).to eq("fancy")
    end
  end
end

Version data entries

49 entries across 49 versions & 5 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/logstash-core-5.6.4-java/spec/logstash/modules/logstash_config_spec.rb