Use rspec wait to fix flakey converge specs

Some converge specs have races, assuming that a running Agent means that pipelines have started running.
This patch lets us wait a while in the event of a race. One such failure is here: https://logstash-ci.elastic.co/job/elastic+logstash+master+multijob-unix-compatibility/os=centos/72/console

Additionally, this removes a harmless double invocation in these specs

Fixes #7912
This commit is contained in:
Andrew Cholakian 2017-08-04 10:55:14 -05:00
parent 3725693098
commit cd6f5bf004

View file

@ -74,19 +74,18 @@ describe LogStash::Agent do
describe "#running_user_defined_pipelines" do describe "#running_user_defined_pipelines" do
it "returns the user defined pipelines" do it "returns the user defined pipelines" do
start_agent(subject) start_agent(subject)
subject.with_running_user_defined_pipelines do |pipelines| wait_for do
expect(pipelines).to include(:main) subject.with_running_user_defined_pipelines {|pipelines| pipelines.keys }
expect(pipelines).not_to include(:system_pipeline) end.to eq([:main])
end
subject.shutdown
end end
end end
describe "#running_user_defined_pipelines?" do describe "#running_user_defined_pipelines?" do
it "returns true" do it "returns true" do
start_agent(subject) start_agent(subject)
expect(subject.running_user_defined_pipelines?).to be_truthy wait_for do
subject.shutdown subject.running_user_defined_pipelines?
end.to be_truthy
end end
end end
end end