From 81e7b18b25f30d99d5ec30b50889c41da32516f8 Mon Sep 17 00:00:00 2001 From: Joao Duarte Date: Sat, 26 Oct 2019 19:55:14 +0100 Subject: [PATCH] don't rely on expect match and last_match in qa test Fixes #11273 --- .../spec/shared_examples/cli/logstash-plugin/list.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qa/acceptance/spec/shared_examples/cli/logstash-plugin/list.rb b/qa/acceptance/spec/shared_examples/cli/logstash-plugin/list.rb index e8e0d1dac..1a04858e1 100644 --- a/qa/acceptance/spec/shared_examples/cli/logstash-plugin/list.rb +++ b/qa/acceptance/spec/shared_examples/cli/logstash-plugin/list.rb @@ -33,7 +33,8 @@ shared_examples "logstash list" do |logstash| stdout = StringIO.new(result.stdout) stdout.set_encoding(Encoding::UTF_8) while line = stdout.gets - expect(line).to match(/^#{plugin_name_with_version}$/) + match = line.match(/^#{plugin_name_with_version}$/) + expect(match).to_not be_nil # Integration Plugins list their sub-plugins, e.g., # ~~~ @@ -41,9 +42,10 @@ shared_examples "logstash list" do |logstash| # ├── logstash-input-kafka # └── logstash-output-kafka # ~~~ - if Regexp.last_match[:type] == 'integration' + if match[:type] == 'integration' while line = stdout.gets - expect(line).to match(/^(?: [├└]── )#{plugin_name}$/) + match = line.match(/^(?: [├└]── )#{plugin_name}$/) + expect(match).to_not be_nil break if line.start_with?(' └') end end