mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -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
9549d1291e
commit
8be69814c8
2 changed files with 7 additions and 1 deletions
|
@ -5,6 +5,7 @@ require 'logstash/version'
|
|||
RSpec.shared_examples "installable" do |logstash|
|
||||
|
||||
before(:each) do
|
||||
logstash.uninstall
|
||||
logstash.install({:version => LOGSTASH_VERSION})
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue