Sha256: 835cc9f81af0e008fa09d345f95e3ae5370062a46c2d43d57428ee1149249d03
Contents?: true
Size: 1.95 KB
Versions: 35
Compression:
Stored size: 1.95 KB
Contents
# encoding: utf-8 require 'spec_helper' describe LogStash::Agent do subject { LogStash::Agent.new('') } let(:dummy_config) { 'input {}' } context "when loading the configuration" do context "when local" do before { expect(subject).to receive(:local_config).with(path) } context "unix" do let(:path) { './test.conf' } it 'works with relative path' do subject.load_config(path) end end context "windows" do let(:path) { '.\test.conf' } it 'work with relative windows path' do subject.load_config(path) end end end context "when remote" do context 'supported scheme' do let(:path) { "http://test.local/superconfig.conf" } before { expect(Net::HTTP).to receive(:get) { dummy_config } } it 'works with http' do expect(subject.load_config(path)).to eq("#{dummy_config}\n") end end end end context "--pluginpath" do let(:single_path) { "/some/path" } let(:multiple_paths) { ["/some/path1", "/some/path2"] } it "should add single valid dir path to the environment" do expect(File).to receive(:directory?).and_return(true) expect(LogStash::Environment).to receive(:add_plugin_path).with(single_path) subject.configure_plugin_paths(single_path) end it "should fail with single invalid dir path" do expect(File).to receive(:directory?).and_return(false) expect(LogStash::Environment).not_to receive(:add_plugin_path) expect{subject.configure_plugin_paths(single_path)}.to raise_error(LogStash::ConfigurationError) end it "should add multiple valid dir path to the environment" do expect(File).to receive(:directory?).exactly(multiple_paths.size).times.and_return(true) multiple_paths.each{|path| expect(LogStash::Environment).to receive(:add_plugin_path).with(path)} subject.configure_plugin_paths(multiple_paths) end end end
Version data entries
35 entries across 32 versions & 3 rubygems