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.
This commit is contained in:
Joao Duarte 2020-07-02 09:47:22 +01:00 committed by João Duarte
parent 29d7dcef94
commit c4834e55ee

View file

@ -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)