spec/inputs/elasticsearch_spec.rb in logstash-input-elasticsearch-4.9.1 vs spec/inputs/elasticsearch_spec.rb in logstash-input-elasticsearch-4.9.2
- old
+ new
@@ -164,11 +164,11 @@
plugin.run([])
end
end
context 'without slices directive' do
- let(:config) { super.tap { |h| h.delete('slices') } }
+ let(:config) { super().tap { |h| h.delete('slices') } }
it 'runs just one slice' do
expect(plugin).to receive(:do_run_slice).with(duck_type(:<<))
expect(Thread).to_not receive(:new)
plugin.register
@@ -561,117 +561,117 @@
describe "cloud.id" do
let(:valid_cloud_id) do
'sample:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlvJGFjMzFlYmI5MDI0MTc3MzE1NzA0M2MzNGZkMjZmZDQ2OjkyNDMkYTRjMDYyMzBlNDhjOGZjZTdiZTg4YTA3NGEzYmIzZTA6OTI0NA=='
end
- let(:config) { super.merge({ 'cloud_id' => valid_cloud_id }) }
+ let(:config) { super().merge({ 'cloud_id' => valid_cloud_id }) }
it "should set host(s)" do
plugin.register
client = plugin.send(:client)
- expect( client.transport.hosts ).to eql [{
- :scheme => "https",
- :host => "ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io",
- :port => 9243,
- :path => "",
- :protocol => "https"
- }]
+ expect( client.transport.instance_variable_get(:@hosts) ).to eql [{
+ :scheme => "https",
+ :host => "ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io",
+ :port => 9243,
+ :path => "",
+ :protocol => "https"
+ }]
end
context 'invalid' do
- let(:config) { super.merge({ 'cloud_id' => 'invalid:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlv' }) }
+ let(:config) { super().merge({ 'cloud_id' => 'invalid:dXMtY2VudHJhbDEuZ2NwLmNsb3VkLmVzLmlv' }) }
it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /cloud_id.*? is invalid/
end
end
context 'hosts also set' do
- let(:config) { super.merge({ 'cloud_id' => valid_cloud_id, 'hosts' => [ 'localhost:9200' ] }) }
+ let(:config) { super().merge({ 'cloud_id' => valid_cloud_id, 'hosts' => [ 'localhost:9200' ] }) }
it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /cloud_id and hosts/
end
end
end if LOGSTASH_VERSION > '6.0'
describe "cloud.auth" do
- let(:config) { super.merge({ 'cloud_auth' => LogStash::Util::Password.new('elastic:my-passwd-00') }) }
+ let(:config) { super().merge({ 'cloud_auth' => LogStash::Util::Password.new('elastic:my-passwd-00') }) }
it "should set authorization" do
plugin.register
client = plugin.send(:client)
- auth_header = client.transport.options[:transport_options][:headers][:Authorization]
+ auth_header = client.transport.instance_variable_get(:@options)[:transport_options][:headers]['Authorization']
expect( auth_header ).to eql "Basic #{Base64.encode64('elastic:my-passwd-00').rstrip}"
end
context 'invalid' do
- let(:config) { super.merge({ 'cloud_auth' => 'invalid-format' }) }
+ let(:config) { super().merge({ 'cloud_auth' => 'invalid-format' }) }
it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /cloud_auth.*? format/
end
end
context 'user also set' do
- let(:config) { super.merge({ 'cloud_auth' => 'elastic:my-passwd-00', 'user' => 'another' }) }
+ let(:config) { super().merge({ 'cloud_auth' => 'elastic:my-passwd-00', 'user' => 'another' }) }
it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Multiple authentication options are specified/
end
end
end if LOGSTASH_VERSION > '6.0'
describe "api_key" do
context "without ssl" do
- let(:config) { super.merge({ 'api_key' => LogStash::Util::Password.new('foo:bar') }) }
+ let(:config) { super().merge({ 'api_key' => LogStash::Util::Password.new('foo:bar') }) }
it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /api_key authentication requires SSL\/TLS/
end
end
context "with ssl" do
- let(:config) { super.merge({ 'api_key' => LogStash::Util::Password.new('foo:bar'), "ssl" => true }) }
+ let(:config) { super().merge({ 'api_key' => LogStash::Util::Password.new('foo:bar'), "ssl" => true }) }
it "should set authorization" do
plugin.register
client = plugin.send(:client)
- auth_header = client.transport.options[:transport_options][:headers][:Authorization]
+ auth_header = client.transport.instance_variable_get(:@options)[:transport_options][:headers]['Authorization']
expect( auth_header ).to eql "ApiKey #{Base64.strict_encode64('foo:bar')}"
end
context 'user also set' do
- let(:config) { super.merge({ 'api_key' => 'foo:bar', 'user' => 'another' }) }
+ let(:config) { super().merge({ 'api_key' => 'foo:bar', 'user' => 'another' }) }
it "should fail" do
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Multiple authentication options are specified/
end
end
end
end if LOGSTASH_VERSION > '6.0'
describe "proxy" do
- let(:config) { super.merge({ 'proxy' => 'http://localhost:1234' }) }
+ let(:config) { super().merge({ 'proxy' => 'http://localhost:1234' }) }
it "should set proxy" do
plugin.register
client = plugin.send(:client)
- proxy = client.transport.options[:transport_options][:proxy]
+ proxy = client.transport.instance_variable_get(:@options)[:transport_options][:proxy]
expect( proxy ).to eql "http://localhost:1234"
end
context 'invalid' do
- let(:config) { super.merge({ 'proxy' => '${A_MISSING_ENV_VAR:}' }) }
+ let(:config) { super().merge({ 'proxy' => '${A_MISSING_ENV_VAR:}' }) }
it "should not set proxy" do
plugin.register
client = plugin.send(:client)
- expect( client.transport.options[:transport_options] ).to_not include(:proxy)
+ expect( client.transport.instance_variable_get(:@options)[:transport_options] ).to_not include(:proxy)
end
end
end
shared_examples'configurable timeout' do |config_name, manticore_transport_option|