Sha256: d8b70b256da38b1b213b51d953fca3109420dfe701655897589aa7a460d8ab18

Contents?: true

Size: 1.73 KB

Versions: 9

Compression:

Stored size: 1.73 KB

Contents

# encoding: utf-8
require 'logstash/outputs/kusto'
require 'logstash/codecs/plain'
require 'logstash/event'

describe LogStash::Outputs::Kusto do

  let(:options) { { "path" => "./kusto_tst/%{+YYYY-MM-dd-HH-mm}",
    "ingest_url" => "https://ingest-sdkse2etest.eastus.kusto.windows.net/",
    "app_id" => "myid",
    "app_key" => "mykey",
    "app_tenant" => "mytenant",
    "database" => "mydatabase",
    "table" => "mytable",
    "json_mapping" => "mymapping",
    "proxy_host" => "localhost",
    "proxy_port" => 3128,
    "proxy_protocol" => "https"
  } }

  describe '#register' do

    it 'doesnt allow the path to start with a dynamic string' do
      kusto = described_class.new(options.merge( {'path' => '/%{name}'} ))
      expect { kusto.register }.to raise_error(LogStash::ConfigurationError)
      kusto.close
    end

    it 'path must include a dynamic string to allow file rotation' do
      kusto = described_class.new(options.merge( {'path' => '/{name}'} ))
      expect { kusto.register }.to raise_error(LogStash::ConfigurationError)
      kusto.close
    end


    dynamic_name_array = ['/a%{name}/', '/a %{name}/', '/a- %{name}/', '/a- %{name}']

    context 'doesnt allow the root directory to have some dynamic part' do
      dynamic_name_array.each do |test_path|
         it "with path: #{test_path}" do
           kusto = described_class.new(options.merge( {'path' => test_path} ))
           expect { kusto.register }.to raise_error(LogStash::ConfigurationError)
           kusto.close
         end
       end
    end

    it 'allow to have dynamic part after the file root' do
      kusto = described_class.new(options.merge({'path' => '/tmp/%{name}'}))
      expect { kusto.register }.not_to raise_error
      kusto.close
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logstash-output-kusto-2.0.8-java spec/outputs/kusto_spec.rb
logstash-output-kusto-2.0.7-java spec/outputs/kusto_spec.rb
logstash-output-kusto-2.0.6-java spec/outputs/kusto_spec.rb
logstash-output-kusto-2.0.5-java spec/outputs/kusto_spec.rb
logstash-output-kusto-2.0.4-java spec/outputs/kusto_spec.rb
logstash-output-kusto-2.0.2-java spec/outputs/kusto_spec.rb
logstash-output-kusto-2.0.1-java spec/outputs/kusto_spec.rb
logstash-output-kusto-2.0.0-java spec/outputs/kusto_spec.rb
logstash-output-kusto-1.0.5-java spec/outputs/kusto_spec.rb