diff --git a/qa/acceptance/spec/shared_examples/installed.rb b/qa/acceptance/spec/shared_examples/installed.rb index 8773dfa4d..3d058134f 100644 --- a/qa/acceptance/spec/shared_examples/installed.rb +++ b/qa/acceptance/spec/shared_examples/installed.rb @@ -5,6 +5,7 @@ require 'logstash/version' RSpec.shared_examples "installable" do |logstash| before(:each) do + logstash.uninstall logstash.install({:version => LOGSTASH_VERSION}) end diff --git a/qa/rspec/commands/redhat.rb b/qa/rspec/commands/redhat.rb index eebba934b..d44aa2d48 100644 --- a/qa/rspec/commands/redhat.rb +++ b/qa/rspec/commands/redhat.rb @@ -23,17 +23,22 @@ module ServiceTester def install(package, host=nil) hosts = (host.nil? ? servers : Array(host)) errors = [] + exit_status = 0 at(hosts, {in: :serial}) do |_host| cmd = sudo_exec!("yum install -y #{package}") + exit_status += cmd.exit_status errors << cmd.stderr unless cmd.stderr.empty? end - raise InstallException.new(errors.join("\n")) unless errors.empty? + if exit_status > 0 + raise InstallException.new(errors.join("\n")) + end end def uninstall(package, host=nil) hosts = (host.nil? ? servers : Array(host)) at(hosts, {in: :serial}) do |_| sudo_exec!("yum remove -y #{package}") + sudo_exec!("rm -rf /etc/logstash") end end