spec/inputs/integration/elasticsearch_spec.rb in logstash-input-elasticsearch-4.18.0 vs spec/inputs/integration/elasticsearch_spec.rb in logstash-input-elasticsearch-4.19.0

- old
+ new

@@ -18,14 +18,11 @@ let(:user) { ENV['ELASTIC_USER'] || 'simpleuser' } let(:password) { ENV['ELASTIC_PASSWORD'] || 'abc123' } let(:ca_file) { "spec/fixtures/test_certs/ca.crt" } - let(:es_url) do - es_url = ESHelper.get_host_port - SECURE_INTEGRATION ? "https://#{es_url}" : "http://#{es_url}" - end + let(:es_url) { "http#{SECURE_INTEGRATION ? 's' : nil}://#{ESHelper.get_host_port}" } let(:curl_args) do config['user'] ? "-u #{config['user']}:#{config['password']}" : '' end @@ -44,31 +41,30 @@ after(:each) do ESHelper.curl_and_get_json_response "#{es_url}/_index_template/*", method: 'DELETE', args: curl_args # This can fail if there are no indexes, ignore failure. ESHelper.curl_and_get_json_response( "#{es_url}/_index/*", method: 'DELETE', args: curl_args) rescue nil + ESHelper.curl_and_get_json_response( "#{es_url}/logs", method: 'DELETE', args: curl_args) rescue nil + ESHelper.curl_and_get_json_response "#{es_url}/_refresh", method: 'POST', args: curl_args end shared_examples 'an elasticsearch index plugin' do before(:each) do plugin.register end it 'should retrieve json event from elasticsearch' do queue = [] plugin.run(queue) + expect(queue.size).to eq(10) event = queue.pop expect(event).to be_a(LogStash::Event) expect(event.get("response")).to eql(404) end end describe 'against an unsecured elasticsearch', integration: true do - before(:each) do - plugin.register - end - it_behaves_like 'an elasticsearch index plugin' end describe 'against a secured elasticsearch', secure_integration: true do @@ -134,6 +130,12 @@ it_behaves_like 'an elasticsearch index plugin' end + describe 'slice', integration: true do + let(:config) { super().merge('slices' => 2, 'size' => 2) } + let(:plugin) { described_class.new(config) } + + it_behaves_like 'an elasticsearch index plugin' + end end