Commit 892150ba authored by anonym's avatar anonym
Browse files

Be more careful with remote shell usage when a scenario has failed.

parent 0f5b0ea3
......@@ -448,12 +448,18 @@ class VM
return execute(cmd, options)
end
def wait_until_remote_shell_is_up(timeout = 90)
def remote_shell_is_up?
msg = 'hello?'
Timeout::timeout(3) do
execute_successfully("echo '#{msg}'").stdout.chomp == msg
end
rescue
false
end
def wait_until_remote_shell_is_up(timeout = 90)
try_for(timeout, :msg => "Remote shell seems to be down") do
Timeout::timeout(3) do
execute_successfully("echo '#{msg}'").stdout.chomp == msg
end
remote_shell_is_up?
end
end
......
......@@ -258,7 +258,6 @@ After('@product') do |scenario|
info_log("Scenario failed at time #{elapsed}")
screen_capture = @screen.capture
save_failure_artifact("Screenshot", screen_capture.getFilename)
save_journal($config['TMPDIR'])
exception_name = scenario.exception.class.name
case exception_name
when 'FirewallAssertionFailedError'
......@@ -275,6 +274,14 @@ After('@product') do |scenario|
when 'TimeSyncingError'
save_failure_artifact("Htpdate logs", "#{$config["TMPDIR"]}/log.htpdate")
end
# Note that the remote shell isn't necessarily running at all
# times a scenario can fail (and a scenario failure could very
# well cause the remote shell to not respond any more, e.g. when
# we cause a system crash), so let's collect everything depending
# on the remote shell here:
if $vm.remote_shell_is_up?
save_journal($config['TMPDIR'])
end
$failure_artifacts.sort!
$failure_artifacts.each do |type, file|
artifact_name = sanitize_filename("#{elapsed}_#{scenario.name}#{File.extname(file)}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment