spec/integration/outputs/update_spec.rb in logstash-output-elasticsearch_java-2.0.2 vs spec/integration/outputs/update_spec.rb in logstash-output-elasticsearch_java-2.1.1.beta1

- old
+ new

@@ -8,12 +8,11 @@ settings = { "manage_template" => true, "index" => "logstash-update", "template_overwrite" => true, "protocol" => protocol, - "hosts" => get_host(), - "port" => get_port(protocol), + "hosts" => "#{get_host()}:#{get_port(protocol)}", "network_host" => get_local_host, "action" => "update" } settings['upsert'] = upsert unless upsert.nil? settings['document_id'] = id unless id.nil? @@ -50,38 +49,38 @@ it "should not create new document" do subject = get_es_output(protocol, "456") subject.register subject.receive(LogStash::Event.new("message" => "sample message here")) - subject.buffer_flush(:final => true) + subject.flush expect {@es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound) end it "should update existing document" do subject = get_es_output(protocol, "123") subject.register subject.receive(LogStash::Event.new("message" => "updated message here")) - subject.buffer_flush(:final => true) + subject.flush r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "123", :refresh => true) insist { r["_source"]["message"] } == 'updated message here' end end context "upsert with #{protocol} protocol" do it "should create new documents with upsert content" do subject = get_es_output(protocol, "456", '{"message": "upsert message"}') subject.register subject.receive(LogStash::Event.new("message" => "sample message here")) - subject.buffer_flush(:final => true) + subject.flush r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true) insist { r["_source"]["message"] } == 'upsert message' end it "should create new documents with event/doc as upsert" do subject = get_es_output(protocol, "456", nil, true) subject.register subject.receive(LogStash::Event.new("message" => "sample message here")) - subject.buffer_flush(:final => true) + subject.flush r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true) insist { r["_source"]["message"] } == 'sample message here' end end end