From c4834e55ee2926ae899f8da7a778b1a8652bc5c4 Mon Sep 17 00:00:00 2001 From: Joao Duarte Date: Thu, 2 Jul 2020 09:47:22 +0100 Subject: [PATCH] ensure pipeline terminates execution before doing assertion This test relies on the generator input sending 10 events and observing the output. Calling shutdown immediately after start can cause the plugin to abort earily. This change waits for the execution to finish before performing the test assertions. --- logstash-core/spec/logstash/java_pipeline_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/logstash-core/spec/logstash/java_pipeline_spec.rb b/logstash-core/spec/logstash/java_pipeline_spec.rb index 430d51a65..68ad5c91a 100644 --- a/logstash-core/spec/logstash/java_pipeline_spec.rb +++ b/logstash-core/spec/logstash/java_pipeline_spec.rb @@ -903,6 +903,7 @@ describe LogStash::JavaPipeline do it "correctly distributes events" do pipeline = mock_java_pipeline_from_string(config, pipeline_settings_obj) pipeline.start + sleep 0.01 until pipeline.finished_execution? pipeline.shutdown expect(output.events.size).to eq(60) expect(output.events.count {|e| e.get("cloned") == "cloned"}).to eq(30)