beaker 4.41.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/test.yml +26 -13
- data/.rubocop.yml +23 -10
- data/.rubocop_todo.yml +34 -10
- data/CHANGELOG.md +16 -52
- data/Gemfile +12 -7
- data/HISTORY.md +605 -0
- data/Rakefile +99 -111
- data/acceptance/config/acceptance-options.rb +1 -1
- data/acceptance/config/base/acceptance-options.rb +2 -2
- data/acceptance/config/hypervisor/acceptance-options.rb +2 -2
- data/acceptance/config/subcommands/acceptance-options.rb +2 -2
- data/acceptance/fixtures/module/Rakefile +1 -1
- data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +8 -12
- data/acceptance/fixtures/module/spec/classes/init_spec.rb +0 -1
- data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +3 -5
- data/acceptance/lib/helpers/test_helper.rb +6 -5
- data/acceptance/pre_suite/subcommands/05_install_ruby.rb +2 -3
- data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -2
- data/acceptance/tests/base/dsl/helpers/configuration_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +1 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/add_system32_hosts_entry_test.rb +0 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +3 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
- data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +0 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +19 -26
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +0 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +18 -13
- data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +22 -27
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +12 -16
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +3 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +5 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +3 -5
- data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +14 -17
- data/acceptance/tests/base/dsl/structure_test.rb +5 -11
- data/acceptance/tests/base/host/file_test.rb +2 -2
- data/acceptance/tests/base/host/group_test.rb +0 -1
- data/acceptance/tests/base/host/host_test.rb +66 -63
- data/acceptance/tests/base/host/packages.rb +1 -2
- data/acceptance/tests/base/host/packages_unix.rb +0 -55
- data/acceptance/tests/base/host/user_test.rb +0 -1
- data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +1 -2
- data/acceptance/tests/base/test_suite/export.rb +6 -9
- data/acceptance/tests/install/from_file.rb +2 -4
- data/acceptance/tests/load_path_bootstrap.rb +1 -1
- data/acceptance/tests/subcommands/destroy.rb +19 -21
- data/acceptance/tests/subcommands/exec.rb +0 -1
- data/acceptance/tests/subcommands/init.rb +2 -3
- data/acceptance/tests/subcommands/provision.rb +0 -1
- data/beaker.gemspec +4 -7
- data/docs/concepts/argument_processing_and_precedence.md +1 -10
- data/docs/how_to/debug_beaker_tests.md +12 -12
- data/docs/how_to/hosts/eos.md +2 -12
- data/docs/how_to/install_puppet.md +0 -18
- data/docs/how_to/the_beaker_dsl.md +0 -2
- data/lib/beaker/cli.rb +59 -68
- data/lib/beaker/command.rb +20 -28
- data/lib/beaker/command_factory.rb +3 -2
- data/lib/beaker/dsl/assertions.rb +6 -18
- data/lib/beaker/dsl/helpers/hocon_helpers.rb +3 -7
- data/lib/beaker/dsl/helpers/host_helpers.rb +62 -123
- data/lib/beaker/dsl/helpers/test_helpers.rb +3 -5
- data/lib/beaker/dsl/helpers/web_helpers.rb +19 -39
- data/lib/beaker/dsl/helpers.rb +2 -4
- data/lib/beaker/dsl/outcomes.rb +13 -15
- data/lib/beaker/dsl/patterns.rb +1 -3
- data/lib/beaker/dsl/roles.rb +17 -20
- data/lib/beaker/dsl/structure.rb +53 -65
- data/lib/beaker/dsl/test_tagging.rb +7 -10
- data/lib/beaker/dsl/wrappers.rb +15 -16
- data/lib/beaker/dsl.rb +2 -3
- data/lib/beaker/host/aix/exec.rb +1 -1
- data/lib/beaker/host/aix/file.rb +0 -1
- data/lib/beaker/host/aix/group.rb +1 -1
- data/lib/beaker/host/aix/user.rb +1 -1
- data/lib/beaker/host/aix.rb +3 -4
- data/lib/beaker/host/cisco.rb +27 -39
- data/lib/beaker/host/eos.rb +4 -30
- data/lib/beaker/host/freebsd/exec.rb +1 -1
- data/lib/beaker/host/freebsd/pkg.rb +3 -3
- data/lib/beaker/host/freebsd.rb +9 -12
- data/lib/beaker/host/mac/exec.rb +4 -4
- data/lib/beaker/host/mac/group.rb +7 -7
- data/lib/beaker/host/mac/pkg.rb +3 -106
- data/lib/beaker/host/mac/user.rb +2 -2
- data/lib/beaker/host/mac.rb +8 -9
- data/lib/beaker/host/pswindows/exec.rb +66 -70
- data/lib/beaker/host/pswindows/file.rb +3 -5
- data/lib/beaker/host/pswindows/group.rb +3 -3
- data/lib/beaker/host/pswindows/pkg.rb +12 -12
- data/lib/beaker/host/pswindows/user.rb +3 -3
- data/lib/beaker/host/pswindows.rb +4 -3
- data/lib/beaker/host/unix/exec.rb +81 -83
- data/lib/beaker/host/unix/file.rb +40 -45
- data/lib/beaker/host/unix/group.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +138 -401
- data/lib/beaker/host/unix/user.rb +2 -2
- data/lib/beaker/host/unix.rb +8 -11
- data/lib/beaker/host/windows/exec.rb +17 -17
- data/lib/beaker/host/windows/file.rb +3 -3
- data/lib/beaker/host/windows/group.rb +3 -3
- data/lib/beaker/host/windows/pkg.rb +3 -54
- data/lib/beaker/host/windows/user.rb +3 -3
- data/lib/beaker/host/windows.rb +12 -12
- data/lib/beaker/host.rb +76 -133
- data/lib/beaker/host_prebuilt_steps.rb +88 -196
- data/lib/beaker/hypervisor/noop.rb +2 -4
- data/lib/beaker/hypervisor.rb +44 -61
- data/lib/beaker/local_connection.rb +2 -4
- data/lib/beaker/logger.rb +68 -76
- data/lib/beaker/logger_junit.rb +21 -25
- data/lib/beaker/network_manager.rb +39 -42
- data/lib/beaker/options/command_line_parser.rb +12 -23
- data/lib/beaker/options/hosts_file_parser.rb +16 -25
- data/lib/beaker/options/options_file_parser.rb +3 -6
- data/lib/beaker/options/options_hash.rb +2 -7
- data/lib/beaker/options/parser.rb +86 -102
- data/lib/beaker/options/presets.rb +114 -123
- data/lib/beaker/options/subcommand_options_file_parser.rb +3 -6
- data/lib/beaker/options/validator.rb +26 -31
- data/lib/beaker/perf.rb +25 -30
- data/lib/beaker/platform.rb +26 -37
- data/lib/beaker/result.rb +7 -6
- data/lib/beaker/shared/error_handler.rb +8 -10
- data/lib/beaker/shared/fog_credentials.rb +5 -9
- data/lib/beaker/shared/host_manager.rb +36 -41
- data/lib/beaker/shared/options_resolver.rb +3 -7
- data/lib/beaker/shared/repetition.rb +2 -4
- data/lib/beaker/shared/semvar.rb +37 -41
- data/lib/beaker/shared/timed.rb +0 -3
- data/lib/beaker/shared.rb +1 -1
- data/lib/beaker/ssh_connection.rb +38 -47
- data/lib/beaker/subcommand.rb +17 -24
- data/lib/beaker/subcommands/subcommand_util.rb +4 -4
- data/lib/beaker/tasks/quick_start.rb +4 -9
- data/lib/beaker/tasks/rake_task.rb +25 -27
- data/lib/beaker/tasks/test.rb +4 -4
- data/lib/beaker/test_case.rb +16 -28
- data/lib/beaker/test_suite.rb +35 -39
- data/lib/beaker/test_suite_result.rb +45 -47
- data/lib/beaker/version.rb +1 -1
- data/lib/beaker.rb +6 -7
- data/spec/beaker/cli_spec.rb +121 -142
- data/spec/beaker/command_spec.rb +55 -59
- data/spec/beaker/dsl/assertions_spec.rb +36 -36
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +110 -131
- data/spec/beaker/dsl/helpers/test_helpers_spec.rb +9 -10
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +22 -31
- data/spec/beaker/dsl/outcomes_spec.rb +14 -14
- data/spec/beaker/dsl/roles_spec.rb +125 -130
- data/spec/beaker/dsl/structure_spec.rb +172 -161
- data/spec/beaker/dsl/test_tagging_spec.rb +89 -90
- data/spec/beaker/dsl/wrappers_spec.rb +32 -33
- data/spec/beaker/host/aix_spec.rb +14 -14
- data/spec/beaker/host/cisco_spec.rb +84 -94
- data/spec/beaker/host/eos_spec.rb +15 -36
- data/spec/beaker/host/freebsd/exec_spec.rb +3 -6
- data/spec/beaker/host/freebsd/pkg_spec.rb +24 -27
- data/spec/beaker/host/mac/exec_spec.rb +2 -3
- data/spec/beaker/host/mac/group_spec.rb +48 -57
- data/spec/beaker/host/mac/user_spec.rb +54 -63
- data/spec/beaker/host/pswindows/exec_spec.rb +30 -32
- data/spec/beaker/host/pswindows/file_spec.rb +16 -16
- data/spec/beaker/host/pswindows/user_spec.rb +17 -23
- data/spec/beaker/host/pswindows_spec.rb +13 -13
- data/spec/beaker/host/unix/exec_spec.rb +75 -80
- data/spec/beaker/host/unix/file_spec.rb +66 -71
- data/spec/beaker/host/unix/pkg_spec.rb +150 -411
- data/spec/beaker/host/unix_spec.rb +11 -207
- data/spec/beaker/host/windows/exec_spec.rb +30 -32
- data/spec/beaker/host/windows/file_spec.rb +18 -19
- data/spec/beaker/host/windows/group_spec.rb +10 -12
- data/spec/beaker/host/windows/pkg_spec.rb +6 -9
- data/spec/beaker/host/windows/user_spec.rb +17 -23
- data/spec/beaker/host/windows_spec.rb +39 -39
- data/spec/beaker/host_prebuilt_steps_spec.rb +168 -349
- data/spec/beaker/host_spec.rb +204 -284
- data/spec/beaker/hypervisor/hypervisor_spec.rb +36 -61
- data/spec/beaker/localhost_connection_spec.rb +10 -11
- data/spec/beaker/logger_junit_spec.rb +19 -30
- data/spec/beaker/logger_spec.rb +153 -136
- data/spec/beaker/network_manager_spec.rb +23 -23
- data/spec/beaker/options/command_line_parser_spec.rb +20 -23
- data/spec/beaker/options/hosts_file_parser_spec.rb +30 -32
- data/spec/beaker/options/options_file_parser_spec.rb +4 -7
- data/spec/beaker/options/options_hash_spec.rb +4 -6
- data/spec/beaker/options/parser_spec.rb +167 -167
- data/spec/beaker/options/presets_spec.rb +7 -9
- data/spec/beaker/options/subcommand_options_parser_spec.rb +13 -14
- data/spec/beaker/options/validator_spec.rb +10 -11
- data/spec/beaker/perf_spec.rb +18 -21
- data/spec/beaker/platform_spec.rb +25 -50
- data/spec/beaker/shared/error_handler_spec.rb +7 -16
- data/spec/beaker/shared/fog_credentials_spec.rb +29 -29
- data/spec/beaker/shared/host_manager_spec.rb +50 -84
- data/spec/beaker/shared/options_resolver_spec.rb +9 -12
- data/spec/beaker/shared/repetition_spec.rb +17 -24
- data/spec/beaker/shared/semvar_spec.rb +21 -26
- data/spec/beaker/ssh_connection_spec.rb +76 -83
- data/spec/beaker/subcommand/subcommand_util_spec.rb +31 -33
- data/spec/beaker/subcommand_spec.rb +75 -77
- data/spec/beaker/test_case_spec.rb +25 -50
- data/spec/beaker/test_suite_spec.rb +147 -154
- data/spec/helpers.rb +39 -45
- data/spec/matchers.rb +8 -7
- data/spec/mocks.rb +1 -6
- data/spec/spec_helper.rb +0 -1
- metadata +8 -24
- data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +0 -142
- data/acceptance/tests/base/external_resources_test.rb +0 -31
- data/spec/beaker/host/mac_spec.rb +0 -113
|
@@ -4,11 +4,9 @@ require 'net/scp'
|
|
|
4
4
|
|
|
5
5
|
module Beaker
|
|
6
6
|
class SshConnection
|
|
7
|
+
attr_accessor :logger, :ip, :vmhostname, :hostname, :ssh_connection_preference
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
attr_accessor :ip, :vmhostname, :hostname, :ssh_connection_preference
|
|
10
|
-
|
|
11
|
-
SUPPORTED_CONNECTION_METHODS = [:ip, :vmhostname, :hostname]
|
|
9
|
+
SUPPORTED_CONNECTION_METHODS = %i[ip vmhostname hostname]
|
|
12
10
|
|
|
13
11
|
RETRYABLE_EXCEPTIONS = [
|
|
14
12
|
SocketError,
|
|
@@ -67,18 +65,18 @@ module Beaker
|
|
|
67
65
|
wait = 3
|
|
68
66
|
max_connection_tries = options[:max_connection_tries] || 11
|
|
69
67
|
begin
|
|
70
|
-
|
|
68
|
+
@logger.debug "Attempting ssh connection to #{host}, user: #{user}, opts: #{ssh_opts}"
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
# Work around net-ssh 6+ incompatibilities
|
|
71
|
+
if ssh_opts.include?(:strict_host_key_checking) && (Net::SSH::Version::CURRENT.major > 5)
|
|
72
|
+
strict_host_key_checking = ssh_opts.delete(:strict_host_key_checking)
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
unless ssh_opts[:verify_host_key].is_a?(Symbol)
|
|
75
|
+
ssh_opts[:verify_host_key] ||= strict_host_key_checking ? :always : :never
|
|
76
|
+
end
|
|
77
|
+
end
|
|
80
78
|
|
|
81
|
-
|
|
79
|
+
Net::SSH.start(host, user, ssh_opts)
|
|
82
80
|
rescue *RETRYABLE_EXCEPTIONS => e
|
|
83
81
|
if try <= max_connection_tries
|
|
84
82
|
@logger.warn "Try #{try} -- Host #{host} unreachable: #{e.class.name} - #{e.message}" unless options[:silent]
|
|
@@ -105,16 +103,14 @@ module Beaker
|
|
|
105
103
|
# Try three ways to connect to host (vmhostname, ip, hostname)
|
|
106
104
|
# Try each method in turn until we succeed
|
|
107
105
|
methods = @ssh_connection_preference.dup
|
|
108
|
-
while (not @ssh) && (not methods.empty?)
|
|
109
|
-
|
|
110
|
-
if SUPPORTED_CONNECTION_METHODS.include?(methods[0])
|
|
111
|
-
@ssh = connect_block(instance_variable_get("@#{methods[0]}"), @user, @ssh_opts, options)
|
|
112
|
-
else
|
|
113
|
-
@logger.warn "Beaker does not support #{methods[0]} to SSH to host, trying next available method."
|
|
114
|
-
@ssh_connection_preference.delete(methods[0])
|
|
115
|
-
end
|
|
116
|
-
else
|
|
106
|
+
while (not @ssh) && (not methods.empty?)
|
|
107
|
+
if instance_variable_get("@#{methods[0]}").nil?
|
|
117
108
|
@logger.warn "Skipping #{methods[0]} method to ssh to host as its value is not set. Refer to https://github.com/puppetlabs/beaker/tree/master/docs/how_to/ssh_connection_preference.md to remove this warning"
|
|
109
|
+
elsif SUPPORTED_CONNECTION_METHODS.include?(methods[0])
|
|
110
|
+
@ssh = connect_block(instance_variable_get("@#{methods[0]}"), @user, @ssh_opts, options)
|
|
111
|
+
else
|
|
112
|
+
@logger.warn "Beaker does not support #{methods[0]} to SSH to host, trying next available method."
|
|
113
|
+
@ssh_connection_preference.delete(methods[0])
|
|
118
114
|
end
|
|
119
115
|
methods.shift
|
|
120
116
|
end
|
|
@@ -157,30 +153,31 @@ module Beaker
|
|
|
157
153
|
try = 1
|
|
158
154
|
last_wait = 2
|
|
159
155
|
wait = 3
|
|
160
|
-
command = 'echo echo' #can be run on all platforms (I'm looking at you, windows)
|
|
156
|
+
command = 'echo echo' # can be run on all platforms (I'm looking at you, windows)
|
|
161
157
|
while try < 11
|
|
162
158
|
result = Result.new(@hostname, command)
|
|
163
159
|
begin
|
|
164
160
|
@logger.notify "Waiting for connection failure on #{@hostname} (attempt #{try}, try again in #{wait} second(s))"
|
|
165
161
|
@logger.debug("\n#{@hostname} #{Time.new.strftime('%H:%M:%S')}$ #{command}")
|
|
166
162
|
@ssh.open_channel do |channel|
|
|
167
|
-
request_terminal_for(
|
|
163
|
+
request_terminal_for(channel, command) if options[:pty]
|
|
168
164
|
|
|
169
165
|
channel.exec(command) do |terminal, success|
|
|
170
166
|
raise Net::SSH::Exception.new("FAILED: to execute command on a new channel on #{@hostname}") unless success
|
|
167
|
+
|
|
171
168
|
register_stdout_for terminal, result, stdout_callback
|
|
172
169
|
register_stderr_for terminal, result, stderr_callback
|
|
173
170
|
register_exit_code_for terminal, result
|
|
174
171
|
|
|
175
|
-
process_stdin_for(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
process_stdin_for(terminal, options[:stdin]) if options[:stdin]
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
loop_tries = 0
|
|
176
|
+
# loop is actually loop_forever, so let it try 3 times and then quit instead of endless blocking
|
|
177
|
+
@ssh.loop { loop_tries += 1; loop_tries < 4 }
|
|
181
178
|
rescue *RETRYABLE_EXCEPTIONS => e
|
|
182
179
|
@logger.debug "Connection on #{@hostname} failed as expected (#{e.class.name} - #{e.message})"
|
|
183
|
-
close #this connection is bad, shut it down
|
|
180
|
+
close # this connection is bad, shut it down
|
|
184
181
|
return true
|
|
185
182
|
end
|
|
186
183
|
slept = 0
|
|
@@ -198,20 +195,21 @@ module Beaker
|
|
|
198
195
|
end
|
|
199
196
|
|
|
200
197
|
def try_to_execute command, options = {}, stdout_callback = nil,
|
|
201
|
-
|
|
198
|
+
stderr_callback = stdout_callback
|
|
202
199
|
|
|
203
200
|
result = Result.new(@hostname, command)
|
|
204
201
|
|
|
205
202
|
@ssh.open_channel do |channel|
|
|
206
|
-
request_terminal_for(
|
|
203
|
+
request_terminal_for(channel, command) if options[:pty]
|
|
207
204
|
|
|
208
205
|
channel.exec(command) do |terminal, success|
|
|
209
206
|
raise Net::SSH::Exception.new("FAILED: to execute command on a new channel on #{@hostname}") unless success
|
|
207
|
+
|
|
210
208
|
register_stdout_for terminal, result, stdout_callback
|
|
211
209
|
register_stderr_for terminal, result, stderr_callback
|
|
212
210
|
register_exit_code_for terminal, result
|
|
213
211
|
|
|
214
|
-
process_stdin_for(
|
|
212
|
+
process_stdin_for(terminal, options[:stdin]) if options[:stdin]
|
|
215
213
|
end
|
|
216
214
|
end
|
|
217
215
|
|
|
@@ -288,11 +286,8 @@ module Beaker
|
|
|
288
286
|
end
|
|
289
287
|
|
|
290
288
|
def scp_to source, target, options = {}
|
|
291
|
-
|
|
292
289
|
local_opts = options.dup
|
|
293
|
-
if local_opts[:recursive].nil?
|
|
294
|
-
local_opts[:recursive] = File.directory?(source)
|
|
295
|
-
end
|
|
290
|
+
local_opts[:recursive] = File.directory?(source) if local_opts[:recursive].nil?
|
|
296
291
|
local_opts[:chunk_size] ||= 16384
|
|
297
292
|
|
|
298
293
|
result = Result.new(@hostname, [source, target])
|
|
@@ -304,15 +299,14 @@ module Beaker
|
|
|
304
299
|
target = self.execute(%{echo "#{target}"}).output.strip.delete('"') if target.include?('%')
|
|
305
300
|
|
|
306
301
|
@ssh.scp.upload! source, target, local_opts do |_ch, name, sent, total|
|
|
307
|
-
result.stdout << "\tcopying %s: %10d/%d\n"
|
|
302
|
+
result.stdout << (format("\tcopying %s: %10d/%d\n", name, sent, total))
|
|
308
303
|
end
|
|
309
304
|
rescue => e
|
|
310
305
|
logger.warn "#{e.class} error in scp'ing. Forcing the connection to close, which should " <<
|
|
311
|
-
|
|
306
|
+
"raise an error."
|
|
312
307
|
close
|
|
313
308
|
end
|
|
314
309
|
|
|
315
|
-
|
|
316
310
|
# Setting these values allows reporting via result.log(test_name)
|
|
317
311
|
result.stdout << " SCP'ed file #{source} to #{@hostname}:#{target}"
|
|
318
312
|
|
|
@@ -324,11 +318,8 @@ module Beaker
|
|
|
324
318
|
end
|
|
325
319
|
|
|
326
320
|
def scp_from source, target, options = {}
|
|
327
|
-
|
|
328
321
|
local_opts = options.dup
|
|
329
|
-
if local_opts[:recursive].nil?
|
|
330
|
-
local_opts[:recursive] = true
|
|
331
|
-
end
|
|
322
|
+
local_opts[:recursive] = true if local_opts[:recursive].nil?
|
|
332
323
|
local_opts[:chunk_size] ||= 16384
|
|
333
324
|
|
|
334
325
|
result = Result.new(@hostname, [source, target])
|
|
@@ -340,11 +331,11 @@ module Beaker
|
|
|
340
331
|
source = self.execute(%{echo "#{source}"}).output.strip.delete('"') if source.include?('%')
|
|
341
332
|
|
|
342
333
|
@ssh.scp.download! source, target, local_opts do |_ch, name, sent, total|
|
|
343
|
-
result.stdout << "\tcopying %s: %10d/%d\n"
|
|
334
|
+
result.stdout << (format("\tcopying %s: %10d/%d\n", name, sent, total))
|
|
344
335
|
end
|
|
345
336
|
rescue => e
|
|
346
337
|
logger.warn "#{e.class} error in scp'ing. Forcing the connection to close, which should " <<
|
|
347
|
-
|
|
338
|
+
"raise an error."
|
|
348
339
|
close
|
|
349
340
|
end
|
|
350
341
|
|
data/lib/beaker/subcommand.rb
CHANGED
|
@@ -46,7 +46,6 @@ module Beaker
|
|
|
46
46
|
class_option :'test-results-file', :type => :string, :group => 'Beaker run'
|
|
47
47
|
class_option :ntp, :type => :boolean, :group => 'Beaker run'
|
|
48
48
|
class_option :'repo-proxy', :type => :boolean, :group => 'Beaker run'
|
|
49
|
-
class_option :'add-el-extras', :type => :boolean, :group => 'Beaker run'
|
|
50
49
|
class_option :'package-proxy', :type => :string, :group => 'Beaker run'
|
|
51
50
|
class_option :validate, :type => :boolean, :group => 'Beaker run'
|
|
52
51
|
class_option :'collect-perf-data', :type => :boolean, :group => 'Beaker run'
|
|
@@ -76,7 +75,7 @@ module Beaker
|
|
|
76
75
|
LONGDESC
|
|
77
76
|
option :help, :type => :boolean, :hide => true
|
|
78
77
|
method_option :hosts, :aliases => '-h', :type => :string, :required => true
|
|
79
|
-
def init
|
|
78
|
+
def init
|
|
80
79
|
if options[:help]
|
|
81
80
|
invoke :help, [], ["init"]
|
|
82
81
|
return
|
|
@@ -87,9 +86,7 @@ module Beaker
|
|
|
87
86
|
options_to_write = SubcommandUtil.sanitize_options_for_save(@cli.configured_options)
|
|
88
87
|
|
|
89
88
|
@cli.logger.notify 'Writing configured options to disk'
|
|
90
|
-
File.
|
|
91
|
-
f.write(options_to_write.to_yaml)
|
|
92
|
-
end
|
|
89
|
+
File.write(SubcommandUtil::SUBCOMMAND_OPTIONS, options_to_write.to_yaml)
|
|
93
90
|
@cli.logger.notify "Options written to #{SubcommandUtil::SUBCOMMAND_OPTIONS}"
|
|
94
91
|
|
|
95
92
|
state = YAML::Store.new(SubcommandUtil::SUBCOMMAND_STATE)
|
|
@@ -105,16 +102,14 @@ module Beaker
|
|
|
105
102
|
flag here to override.
|
|
106
103
|
LONGDESC
|
|
107
104
|
option :help, :type => :boolean, :hide => true
|
|
108
|
-
def provision
|
|
105
|
+
def provision
|
|
109
106
|
if options[:help]
|
|
110
107
|
invoke :help, [], ["provision"]
|
|
111
108
|
return
|
|
112
109
|
end
|
|
113
110
|
|
|
114
111
|
state = YAML::Store.new(SubcommandUtil::SUBCOMMAND_STATE)
|
|
115
|
-
if state.transaction { state['provisioned']}
|
|
116
|
-
SubcommandUtil.error_with('Provisioned SUTs detected. Please destroy and reprovision.')
|
|
117
|
-
end
|
|
112
|
+
SubcommandUtil.error_with('Provisioned SUTs detected. Please destroy and reprovision.') if state.transaction { state['provisioned'] }
|
|
118
113
|
|
|
119
114
|
@cli.parse_options
|
|
120
115
|
@cli.provision
|
|
@@ -154,7 +149,7 @@ module Beaker
|
|
|
154
149
|
such as: exec pre-suite,tests
|
|
155
150
|
LONG_DESC
|
|
156
151
|
option :help, :type => :boolean, :hide => true
|
|
157
|
-
def exec(resource=nil)
|
|
152
|
+
def exec(resource = nil)
|
|
158
153
|
if options[:help]
|
|
159
154
|
invoke :help, [], ["exec"]
|
|
160
155
|
return
|
|
@@ -168,7 +163,7 @@ module Beaker
|
|
|
168
163
|
return
|
|
169
164
|
end
|
|
170
165
|
|
|
171
|
-
beaker_suites = [
|
|
166
|
+
beaker_suites = %i[pre_suite tests post_suite pre_cleanup]
|
|
172
167
|
resources = resource.split(',')
|
|
173
168
|
paths = resources.map { |r| Pathname(r) }
|
|
174
169
|
if paths.all?(&:exist?)
|
|
@@ -198,13 +193,13 @@ module Beaker
|
|
|
198
193
|
|
|
199
194
|
@cli.execute!
|
|
200
195
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
196
|
+
return unless options['preserve-state']
|
|
197
|
+
|
|
198
|
+
@cli.logger.notify 'updating HOSTS key in subcommand_options'
|
|
199
|
+
hosts = SubcommandUtil.sanitize_options_for_save(@cli.combined_instance_and_options_hosts)
|
|
200
|
+
options_storage = YAML::Store.new(SubcommandUtil::SUBCOMMAND_OPTIONS)
|
|
201
|
+
options_storage.transaction do
|
|
202
|
+
options_storage['HOSTS'] = hosts
|
|
208
203
|
end
|
|
209
204
|
end
|
|
210
205
|
|
|
@@ -213,25 +208,23 @@ module Beaker
|
|
|
213
208
|
Destroys the currently provisioned VMs
|
|
214
209
|
LONG_DESC
|
|
215
210
|
option :help, :type => :boolean, :hide => true
|
|
216
|
-
def destroy
|
|
211
|
+
def destroy
|
|
217
212
|
if options[:help]
|
|
218
213
|
invoke :help, [], ["destroy"]
|
|
219
214
|
return
|
|
220
215
|
end
|
|
221
216
|
|
|
222
217
|
state = YAML::Store.new(SubcommandUtil::SUBCOMMAND_STATE)
|
|
223
|
-
unless state.transaction { state['provisioned']}
|
|
224
|
-
SubcommandUtil.error_with('Please provision an environment')
|
|
225
|
-
end
|
|
218
|
+
SubcommandUtil.error_with('Please provision an environment') unless state.transaction { state['provisioned'] }
|
|
226
219
|
|
|
227
220
|
@cli.parse_options
|
|
228
221
|
@cli.options[:provision] = false
|
|
229
222
|
@cli.initialize_network_manager
|
|
230
223
|
@cli.network_manager.cleanup
|
|
231
224
|
|
|
232
|
-
state.transaction
|
|
225
|
+
state.transaction do
|
|
233
226
|
state.delete('provisioned')
|
|
234
|
-
|
|
227
|
+
end
|
|
235
228
|
end
|
|
236
229
|
end
|
|
237
230
|
end
|
|
@@ -17,10 +17,11 @@ module Beaker
|
|
|
17
17
|
PERSISTED_HOSTS = Pathname("#{CONFIG_DIR}/.hosts.yaml")
|
|
18
18
|
PERSISTED_HYPERVISORS = Pathname("#{CONFIG_DIR}/.hypervisors.yaml")
|
|
19
19
|
# These options should not be part of persisted subcommand state
|
|
20
|
-
UNPERSISTED_OPTIONS = [
|
|
20
|
+
UNPERSISTED_OPTIONS = %i[beaker_version command_line hosts_file logger password_prompt timestamp]
|
|
21
21
|
|
|
22
22
|
def self.execute_subcommand?(arg0)
|
|
23
23
|
return false if arg0.nil?
|
|
24
|
+
|
|
24
25
|
(Beaker::Subcommand.instance_methods(false) << :help).include? arg0.to_sym
|
|
25
26
|
end
|
|
26
27
|
|
|
@@ -46,9 +47,9 @@ module Beaker
|
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
# Print a message to the console and exit with specified exit code, defaults to 1
|
|
49
|
-
#
|
|
50
|
+
# @param [String] msg the message to output
|
|
50
51
|
# @param [Hash<Object>] options to specify exit code or output stack trace
|
|
51
|
-
def self.error_with(msg, options={})
|
|
52
|
+
def self.error_with(msg, options = {})
|
|
52
53
|
puts msg
|
|
53
54
|
puts options[:stack_trace] if options[:stack_trace]
|
|
54
55
|
exit_code = options[:exit_code] ? options[:exit_code] : 1
|
|
@@ -68,7 +69,6 @@ module Beaker
|
|
|
68
69
|
$stderr = old_stderr
|
|
69
70
|
end
|
|
70
71
|
end
|
|
71
|
-
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|
|
@@ -3,12 +3,11 @@ require 'beaker-hostgenerator'
|
|
|
3
3
|
CONFIG_DIR = 'acceptance/config'
|
|
4
4
|
|
|
5
5
|
VAGRANT = ['ubuntu1404-64default.mdcal-ubuntu1404-64af', '--hypervisor=vagrant',
|
|
6
|
-
'--global-config={box_url=https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm,box=puppetlabs/ubuntu-14.04-64-nocm}']
|
|
6
|
+
'--global-config={box_url=https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm,box=puppetlabs/ubuntu-14.04-64-nocm}',]
|
|
7
7
|
|
|
8
8
|
VMPOOLER = ['redhat7-64default.mdcal-redhat7-64af']
|
|
9
9
|
|
|
10
10
|
namespace :beaker_quickstart do
|
|
11
|
-
|
|
12
11
|
desc 'Generate Default Beaker Host Config File, valid options are: vmpooler or vagrant.'
|
|
13
12
|
task :gen_hosts, [:hypervisor] do |_t, args|
|
|
14
13
|
hosts_file = "#{CONFIG_DIR}/default_#{args[:hypervisor]}_hosts.yaml"
|
|
@@ -33,7 +32,6 @@ namespace :beaker_quickstart do
|
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
|
|
36
|
-
|
|
37
35
|
desc 'Generate Default Pre-Suite'
|
|
38
36
|
task :gen_pre_suite do
|
|
39
37
|
pre_suite_file = "acceptance/setup/default_pre_suite.rb"
|
|
@@ -71,20 +69,17 @@ end")
|
|
|
71
69
|
|
|
72
70
|
desc 'Run Default Smoke Test, after generating default host config and test files, valid options are: vmpooler or vagrant.'
|
|
73
71
|
task :run_test, [:hypervisor] => ["beaker_quickstart:gen_hosts", 'beaker_quickstart:gen_pre_suite',
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
system_args = Hash.new
|
|
72
|
+
'beaker_quickstart:gen_smoke_test',] do |_t, args|
|
|
73
|
+
hypervisor = args[:hypervisor] ||= 'vagrant'
|
|
74
|
+
system_args = {}
|
|
78
75
|
system_args[:hosts] = "acceptance/config/default_#{hypervisor}_hosts.yaml"
|
|
79
76
|
system_args[:pre_suite] = 'acceptance/setup/default_pre_suite.rb'
|
|
80
77
|
system_args[:tests] = 'acceptance/tests/default_smoke_test.rb'
|
|
81
78
|
puts "About to run - #{beaker_command(system_args)}"
|
|
82
79
|
system(beaker_command(system_args))
|
|
83
80
|
end
|
|
84
|
-
|
|
85
81
|
end
|
|
86
82
|
|
|
87
|
-
|
|
88
83
|
def beaker_command(system_args)
|
|
89
84
|
cmd_parts = []
|
|
90
85
|
cmd_parts << "beaker"
|
|
@@ -3,7 +3,6 @@ require 'rake/tasklib'
|
|
|
3
3
|
require 'rake'
|
|
4
4
|
require 'beaker'
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
module Beaker
|
|
8
7
|
module Tasks
|
|
9
8
|
class RakeTask < ::Rake::TaskLib
|
|
@@ -11,17 +10,17 @@ module Beaker
|
|
|
11
10
|
|
|
12
11
|
DEFAULT_ACCEPTANCE_ROOT = "./acceptance"
|
|
13
12
|
|
|
14
|
-
COMMAND_OPTIONS = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
COMMAND_OPTIONS = %i[fail_mode
|
|
14
|
+
hosts
|
|
15
|
+
helper
|
|
16
|
+
keyfile
|
|
17
|
+
log_level
|
|
18
|
+
options_file
|
|
19
|
+
preserve_hosts
|
|
20
|
+
tests
|
|
21
|
+
type
|
|
22
|
+
acceptance_root
|
|
23
|
+
name]
|
|
25
24
|
# iterates of acceptable params
|
|
26
25
|
COMMAND_OPTIONS.each do |sym|
|
|
27
26
|
attr_accessor(sym.to_sym)
|
|
@@ -31,16 +30,17 @@ module Beaker
|
|
|
31
30
|
# @param args [Array] First argument is always the name of the task
|
|
32
31
|
# if no additonal arguments are defined such as parameters it will default to [:hosts,:type]
|
|
33
32
|
def initialize(*args, &task_block)
|
|
33
|
+
super
|
|
34
|
+
|
|
34
35
|
@name = args.shift || 'beaker:test'
|
|
35
|
-
if args.empty?
|
|
36
|
-
args = [:hosts,:type]
|
|
37
|
-
end
|
|
36
|
+
args = %i[hosts type] if args.empty?
|
|
38
37
|
@acceptance_root = DEFAULT_ACCEPTANCE_ROOT
|
|
39
38
|
@options_file = nil
|
|
40
39
|
define(args, &task_block)
|
|
41
40
|
end
|
|
42
41
|
|
|
43
42
|
private
|
|
43
|
+
|
|
44
44
|
# Run the task provided, implements the rake task interface
|
|
45
45
|
#
|
|
46
46
|
# @param verbose [bool] Defines wether to run in verbose mode or not
|
|
@@ -51,10 +51,10 @@ module Beaker
|
|
|
51
51
|
command = beaker_command
|
|
52
52
|
puts command if verbose
|
|
53
53
|
success = system(command)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
return unless fail_mode == "fast" && !success
|
|
55
|
+
|
|
56
|
+
$stderr.puts "#{command} failed"
|
|
57
|
+
exit $?.exitstatus
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
# @private
|
|
@@ -75,19 +75,17 @@ module Beaker
|
|
|
75
75
|
# if no other options file is provided
|
|
76
76
|
#
|
|
77
77
|
def check_for_beaker_type_config
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
return unless !@options_file && File.exist?("#{@acceptance_root}/.beaker-#{@type}.cfg")
|
|
79
|
+
|
|
80
|
+
@options_file = File.join(@acceptance_root, ".beaker-#{@type}.cfg")
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
#
|
|
84
84
|
# Check for existence of ENV variables for test if !@tests is undef
|
|
85
85
|
#
|
|
86
86
|
def check_env_variables
|
|
87
|
-
if File.exist?(File.join(DEFAULT_ACCEPTANCE_ROOT, 'tests'))
|
|
88
|
-
|
|
89
|
-
end
|
|
90
|
-
@tests = ENV['TESTS'] || ENV['TEST'] if !@tests
|
|
87
|
+
@tests = File.join(DEFAULT_ACCEPTANCE_ROOT, 'tests') if File.exist?(File.join(DEFAULT_ACCEPTANCE_ROOT, 'tests'))
|
|
88
|
+
@tests = ENV['TESTS'] || ENV.fetch('TEST', nil) if !@tests
|
|
91
89
|
end
|
|
92
90
|
|
|
93
91
|
#
|
|
@@ -97,7 +95,7 @@ module Beaker
|
|
|
97
95
|
cmd_parts = []
|
|
98
96
|
cmd_parts << "beaker"
|
|
99
97
|
cmd_parts << "--keyfile #{@keyfile}" if @keyfile
|
|
100
|
-
cmd_parts << "--hosts #{@hosts}" if (@hosts!=nil && !@hosts.empty?)
|
|
98
|
+
cmd_parts << "--hosts #{@hosts}" if (@hosts != nil && !@hosts.empty?)
|
|
101
99
|
cmd_parts << "--tests #{tests}" if @tests
|
|
102
100
|
cmd_parts << "--options-file #{@options_file}" if @options_file
|
|
103
101
|
cmd_parts << "--type #{@type}" if @type
|
data/lib/beaker/tasks/test.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
require 'beaker/tasks/rake_task'
|
|
2
2
|
|
|
3
|
-
Beaker::Tasks::RakeTask.new do |t,args|
|
|
3
|
+
Beaker::Tasks::RakeTask.new do |t, args|
|
|
4
4
|
t.type = args[:type]
|
|
5
5
|
t.hosts = args[:hosts]
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
desc "Run Beaker PE tests"
|
|
9
|
-
Beaker::Tasks::RakeTask.new("beaker:test:pe"
|
|
9
|
+
Beaker::Tasks::RakeTask.new("beaker:test:pe", :hosts) do |t, args|
|
|
10
10
|
t.type = 'pe'
|
|
11
11
|
t.hosts = args[:hosts]
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
desc "Run Beaker Git tests"
|
|
15
|
-
Beaker::Tasks::RakeTask.new("beaker:test:git"
|
|
15
|
+
Beaker::Tasks::RakeTask.new("beaker:test:git", :hosts) do |t, args|
|
|
16
16
|
t.type = 'git'
|
|
17
17
|
t.hosts = args[:hosts]
|
|
18
|
-
end
|
|
18
|
+
end
|
data/lib/beaker/test_case.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[
|
|
1
|
+
%w[host dsl].each do |lib|
|
|
2
2
|
require "beaker/#{lib}"
|
|
3
3
|
end
|
|
4
4
|
|
|
@@ -22,7 +22,7 @@ module Beaker
|
|
|
22
22
|
include Beaker::DSL
|
|
23
23
|
|
|
24
24
|
# The Exception raised by Ruby's STDLIB's test framework (Ruby 1.9)
|
|
25
|
-
TEST_EXCEPTION_CLASS = ::
|
|
25
|
+
TEST_EXCEPTION_CLASS = ::MiniTest::Assertion
|
|
26
26
|
|
|
27
27
|
# Necessary for implementing {Beaker::DSL::Helpers#confine}.
|
|
28
28
|
# Assumed to be an array of valid {Beaker::Host} objects for
|
|
@@ -41,10 +41,10 @@ module Beaker
|
|
|
41
41
|
# Assumed to be an Array.
|
|
42
42
|
attr_accessor :exports
|
|
43
43
|
|
|
44
|
-
#The full log for this test
|
|
44
|
+
# The full log for this test
|
|
45
45
|
attr_accessor :sublog
|
|
46
46
|
|
|
47
|
-
#The result for the last command run
|
|
47
|
+
# The result for the last command run
|
|
48
48
|
attr_accessor :last_result
|
|
49
49
|
|
|
50
50
|
# A Hash of 'product name' => 'version installed', only set when
|
|
@@ -71,31 +71,21 @@ module Beaker
|
|
|
71
71
|
# The exception that may have stopped this test's execution.
|
|
72
72
|
attr_reader :exception
|
|
73
73
|
|
|
74
|
-
#
|
|
75
|
-
# The amount of time taken to execute the test. Unused, probably soon
|
|
76
|
-
# to be removed or refactored.
|
|
74
|
+
# The amount of time taken to execute the test
|
|
77
75
|
attr_reader :runtime
|
|
78
76
|
|
|
79
77
|
# An Array of Procs to be called after test execution has stopped
|
|
80
78
|
# (whether by exception or not).
|
|
81
79
|
attr_reader :teardown_procs
|
|
82
80
|
|
|
83
|
-
# @deprecated
|
|
84
|
-
# Legacy accessor from when test files would only contain one remote
|
|
85
|
-
# action. Contains the Result of the last call to utilize
|
|
86
|
-
# {Beaker::DSL::Helpers#on}. Do not use as it is not safe
|
|
87
|
-
# in test files that use multiple calls to
|
|
88
|
-
# {Beaker::DSL::Helpers#on}.
|
|
89
|
-
attr_accessor :result
|
|
90
|
-
|
|
91
81
|
# @param [Hosts,Array<Host>] these_hosts The hosts to execute this test
|
|
92
82
|
# against/on.
|
|
93
83
|
# @param [Logger] logger A logger that implements
|
|
94
84
|
# {Beaker::Logger}'s interface.
|
|
95
85
|
# @param [Hash{Symbol=>String}] options Parsed command line options.
|
|
96
86
|
# @param [String] path The local path to a test file to be executed.
|
|
97
|
-
def initialize(these_hosts, logger, options={}, path=nil)
|
|
98
|
-
@hosts
|
|
87
|
+
def initialize(these_hosts, logger, options = {}, path = nil)
|
|
88
|
+
@hosts = these_hosts
|
|
99
89
|
@logger = logger
|
|
100
90
|
@sublog = ""
|
|
101
91
|
@options = options
|
|
@@ -109,7 +99,6 @@ module Beaker
|
|
|
109
99
|
@exports = []
|
|
110
100
|
set_current_test_filename(@path ? File.basename(@path, '.rb') : nil)
|
|
111
101
|
|
|
112
|
-
|
|
113
102
|
#
|
|
114
103
|
# We put this on each wrapper (rather than the class) so that methods
|
|
115
104
|
# defined in the tests don't leak out to other tests.
|
|
@@ -120,17 +109,17 @@ module Beaker
|
|
|
120
109
|
|
|
121
110
|
set_current_step_name(nil)
|
|
122
111
|
|
|
123
|
-
#add arbitrary role methods
|
|
112
|
+
# add arbitrary role methods
|
|
124
113
|
roles = []
|
|
125
114
|
@hosts.each do |host|
|
|
126
115
|
roles << host[:roles]
|
|
127
116
|
end
|
|
128
|
-
add_role_def(
|
|
117
|
+
add_role_def(roles.flatten.uniq)
|
|
129
118
|
|
|
130
119
|
@runtime = Benchmark.realtime do
|
|
131
120
|
begin
|
|
132
121
|
test = File.read(path)
|
|
133
|
-
eval test,nil,path,1
|
|
122
|
+
eval test, nil, path, 1
|
|
134
123
|
rescue FailTest, TEST_EXCEPTION_CLASS => e
|
|
135
124
|
log_and_fail_test(e, :fail)
|
|
136
125
|
rescue PassTest
|
|
@@ -168,18 +157,18 @@ module Beaker
|
|
|
168
157
|
#
|
|
169
158
|
# @param exception [Exception] exception to fail with
|
|
170
159
|
# @param exception [Symbol] the test status
|
|
171
|
-
def log_and_fail_test(exception, status
|
|
160
|
+
def log_and_fail_test(exception, status = :error)
|
|
172
161
|
logger.error("#{exception.class}: #{exception.message}")
|
|
173
162
|
bt = exception.backtrace
|
|
174
163
|
logger.pretty_backtrace(bt).each_line do |line|
|
|
175
164
|
logger.error(line)
|
|
176
165
|
end
|
|
177
166
|
# If the status is already a test failure or error, don't overwrite with the teardown failure.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
167
|
+
return if status == :teardown_error && (@test_status == :error || @test_status == :fail)
|
|
168
|
+
|
|
169
|
+
status = :error if status == :teardown_error
|
|
170
|
+
@test_status = status
|
|
171
|
+
@exception = exception
|
|
183
172
|
end
|
|
184
173
|
end
|
|
185
174
|
end
|
|
@@ -198,6 +187,5 @@ module Beaker
|
|
|
198
187
|
end
|
|
199
188
|
hash
|
|
200
189
|
end
|
|
201
|
-
|
|
202
190
|
end
|
|
203
191
|
end
|