mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
make redhat test uninstall a packege after test are done also making sure install errors are raised only when an error code is != 0
Fixes #5936
This commit is contained in:
parent
bcc14b15a6
commit
c8705f49b8
2 changed files with 7 additions and 1 deletions
|
@ -5,6 +5,7 @@ require 'logstash/version'
|
||||||
RSpec.shared_examples "installable" do |logstash|
|
RSpec.shared_examples "installable" do |logstash|
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
|
logstash.uninstall
|
||||||
logstash.install({:version => LOGSTASH_VERSION})
|
logstash.install({:version => LOGSTASH_VERSION})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,22 @@ module ServiceTester
|
||||||
def install(package, host=nil)
|
def install(package, host=nil)
|
||||||
hosts = (host.nil? ? servers : Array(host))
|
hosts = (host.nil? ? servers : Array(host))
|
||||||
errors = []
|
errors = []
|
||||||
|
exit_status = 0
|
||||||
at(hosts, {in: :serial}) do |_host|
|
at(hosts, {in: :serial}) do |_host|
|
||||||
cmd = sudo_exec!("yum install -y #{package}")
|
cmd = sudo_exec!("yum install -y #{package}")
|
||||||
|
exit_status += cmd.exit_status
|
||||||
errors << cmd.stderr unless cmd.stderr.empty?
|
errors << cmd.stderr unless cmd.stderr.empty?
|
||||||
end
|
end
|
||||||
raise InstallException.new(errors.join("\n")) unless errors.empty?
|
if exit_status > 0
|
||||||
|
raise InstallException.new(errors.join("\n"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def uninstall(package, host=nil)
|
def uninstall(package, host=nil)
|
||||||
hosts = (host.nil? ? servers : Array(host))
|
hosts = (host.nil? ? servers : Array(host))
|
||||||
at(hosts, {in: :serial}) do |_|
|
at(hosts, {in: :serial}) do |_|
|
||||||
sudo_exec!("yum remove -y #{package}")
|
sudo_exec!("yum remove -y #{package}")
|
||||||
|
sudo_exec!("rm -rf /etc/logstash")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue