beaker 1.21.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/CONTRIBUTING.md +1 -0
- data/HISTORY.md +17288 -2
- data/Rakefile +6 -2
- data/beaker.gemspec +15 -19
- data/lib/beaker.rb +2 -5
- data/lib/beaker/answers.rb +2 -0
- data/lib/beaker/answers/version34.rb +37 -1
- data/lib/beaker/cli.rb +4 -0
- data/lib/beaker/command.rb +16 -84
- data/lib/beaker/command_factory.rb +13 -2
- data/lib/beaker/dsl/assertions.rb +25 -2
- data/lib/beaker/dsl/ezbake_utils.rb +2 -2
- data/lib/beaker/dsl/helpers.rb +66 -12
- data/lib/beaker/dsl/install_utils.rb +128 -66
- data/lib/beaker/dsl/wrappers.rb +41 -3
- data/lib/beaker/host.rb +42 -6
- data/lib/beaker/host/mac.rb +62 -0
- data/lib/beaker/host/mac/group.rb +96 -0
- data/lib/beaker/host/mac/user.rb +93 -0
- data/lib/beaker/host/unix/exec.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +11 -11
- data/lib/beaker/host/windows.rb +4 -4
- data/lib/beaker/host_prebuilt_steps.rb +194 -58
- data/lib/beaker/hypervisor.rb +16 -9
- data/lib/beaker/hypervisor/aws_sdk.rb +61 -17
- data/lib/beaker/hypervisor/docker.rb +14 -2
- data/lib/beaker/hypervisor/ec2_helper.rb +15 -3
- data/lib/beaker/hypervisor/vagrant.rb +22 -10
- data/lib/beaker/hypervisor/vagrant_libvirt.rb +11 -0
- data/lib/beaker/hypervisor/vagrant_virtualbox.rb +1 -1
- data/lib/beaker/hypervisor/vcloud_pooled.rb +8 -39
- data/lib/beaker/logger.rb +15 -9
- data/lib/beaker/network_manager.rb +2 -2
- data/lib/beaker/options/command_line_parser.rb +1 -1
- data/lib/beaker/options/parser.rb +1 -8
- data/lib/beaker/options/presets.rb +70 -45
- data/lib/beaker/perf.rb +3 -4
- data/lib/beaker/platform.rb +2 -1
- data/lib/beaker/result.rb +3 -9
- data/lib/beaker/ssh_connection.rb +2 -0
- data/lib/beaker/test_case.rb +2 -21
- data/lib/beaker/test_suite.rb +21 -25
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/answers_spec.rb +36 -0
- data/spec/beaker/cli_spec.rb +45 -45
- data/spec/beaker/command_spec.rb +25 -36
- data/spec/beaker/dsl/assertions_spec.rb +20 -27
- data/spec/beaker/dsl/ezbake_utils_spec.rb +5 -5
- data/spec/beaker/dsl/helpers_spec.rb +293 -208
- data/spec/beaker/dsl/install_utils_spec.rb +310 -189
- data/spec/beaker/dsl/outcomes_spec.rb +6 -6
- data/spec/beaker/dsl/roles_spec.rb +27 -18
- data/spec/beaker/dsl/structure_spec.rb +11 -11
- data/spec/beaker/dsl/wrappers_spec.rb +35 -11
- data/spec/beaker/host/mac/group_spec.rb +124 -0
- data/spec/beaker/host/mac/user_spec.rb +134 -0
- data/spec/beaker/host/unix/pkg_spec.rb +40 -24
- data/spec/beaker/host/windows/group_spec.rb +1 -1
- data/spec/beaker/host_prebuilt_steps_spec.rb +194 -68
- data/spec/beaker/host_spec.rb +145 -67
- data/spec/beaker/hypervisor/aixer_spec.rb +6 -6
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +22 -7
- data/spec/beaker/hypervisor/docker_spec.rb +71 -50
- data/spec/beaker/hypervisor/ec2_helper_spec.rb +25 -4
- data/spec/beaker/hypervisor/fusion_spec.rb +2 -2
- data/spec/beaker/hypervisor/hypervisor_spec.rb +20 -27
- data/spec/beaker/hypervisor/hypervisor_spec.rb.orig +80 -0
- data/spec/beaker/hypervisor/solaris_spec.rb +8 -8
- data/spec/beaker/hypervisor/vagrant_fusion_spec.rb +6 -8
- data/spec/beaker/hypervisor/vagrant_libvirt_spec.rb +34 -0
- data/spec/beaker/hypervisor/vagrant_spec.rb +34 -33
- data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +18 -8
- data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +6 -8
- data/spec/beaker/hypervisor/vcloud_pooled_spec.rb +8 -8
- data/spec/beaker/hypervisor/vcloud_spec.rb +10 -10
- data/spec/beaker/hypervisor/vsphere_helper_spec.rb +8 -8
- data/spec/beaker/hypervisor/vsphere_spec.rb +1 -1
- data/spec/beaker/logger_spec.rb +45 -31
- data/spec/beaker/options/command_line_parser_spec.rb +10 -2
- data/spec/beaker/options/hosts_file_parser_spec.rb +9 -2
- data/spec/beaker/options/options_hash_spec.rb +2 -2
- data/spec/beaker/options/parser_spec.rb +2 -2
- data/spec/beaker/options/pe_version_scaper_spec.rb +6 -1
- data/spec/beaker/options/presets_spec.rb +11 -1
- data/spec/beaker/shared/error_handler_spec.rb +5 -5
- data/spec/beaker/shared/host_manager_spec.rb +3 -2
- data/spec/beaker/shared/repetition_spec.rb +18 -18
- data/spec/beaker/ssh_connection_spec.rb +33 -4
- data/spec/beaker/test_case_spec.rb +9 -9
- data/spec/beaker/test_suite_spec.rb +14 -14
- data/spec/helpers.rb +4 -4
- data/spec/matchers.rb +4 -4
- data/spec/mocks.rb +5 -1
- data/spec/spec_helper.rb +2 -8
- metadata +114 -80
- data/lib/beaker/hypervisor/blimper.rb +0 -108
- data/spec/beaker/hypervisor/blimper_spec.rb +0 -42
- data/spec/beaker/options/data/LATEST +0 -1
- data/spec/beaker/puppet_command_spec.rb +0 -161
- data/spec/mock_blimpy.rb +0 -48
data/lib/beaker/perf.rb
CHANGED
@@ -4,8 +4,8 @@ module Beaker
|
|
4
4
|
|
5
5
|
PERF_PACKAGES = ['sysstat']
|
6
6
|
# SLES does not treat sysstat as a service that can be started
|
7
|
-
PERF_SUPPORTED_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|sles/
|
8
|
-
PERF_START_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el/
|
7
|
+
PERF_SUPPORTED_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus|sles/
|
8
|
+
PERF_START_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus/
|
9
9
|
|
10
10
|
# Create the Perf instance and runs setup_perf_on_host on all hosts if --collect-perf-data
|
11
11
|
# was used as an option on the Baker command line invocation. Instances of this class do not
|
@@ -39,7 +39,7 @@ module Beaker
|
|
39
39
|
@logger.perf_output("Perf (sysstat) not supported on host: " + host)
|
40
40
|
end
|
41
41
|
|
42
|
-
if host['platform'] =~ /debian|ubuntu/
|
42
|
+
if host['platform'] =~ /debian|ubuntu|cumulus/
|
43
43
|
@logger.perf_output("Modify /etc/default/sysstat on Debian and Ubuntu platforms")
|
44
44
|
host.exec(Command.new('sed -i s/ENABLED=\"false\"/ENABLED=\"true\"/ /etc/default/sysstat'))
|
45
45
|
elsif host['platform'] =~ /sles/
|
@@ -52,7 +52,6 @@ module Beaker
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# Iterate over all hosts, calling get_perf_data
|
55
|
-
# @param [void]
|
56
55
|
# @return [void]
|
57
56
|
def print_perf_info()
|
58
57
|
@perf_end_timestamp = Time.now
|
data/lib/beaker/platform.rb
CHANGED
@@ -3,7 +3,7 @@ module Beaker
|
|
3
3
|
# all String methods while adding several platform-specific use cases.
|
4
4
|
class Platform < String
|
5
5
|
# Supported platforms
|
6
|
-
PLATFORMS = /^(osx|centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el)\-.+\-.+$/
|
6
|
+
PLATFORMS = /^(osx|centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el|eos|cumulus)\-.+\-.+$/
|
7
7
|
|
8
8
|
# Platform version numbers vs. codenames conversion hash
|
9
9
|
PLATFORM_VERSION_CODES =
|
@@ -48,6 +48,7 @@ module Beaker
|
|
48
48
|
# * solaris
|
49
49
|
# * aix
|
50
50
|
# * el
|
51
|
+
# * cumulus
|
51
52
|
def initialize(name)
|
52
53
|
if name !~ PLATFORMS
|
53
54
|
raise ArgumentError, "Unsupported platform name #{name}"
|
data/lib/beaker/result.rb
CHANGED
@@ -31,15 +31,9 @@ module Beaker
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def convert string
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
string.force_encoding('UTF-8')
|
38
|
-
return string.chars.select{|i| i.valid_encoding?}.join
|
39
|
-
else
|
40
|
-
# We're running in < 1.9 and Ruby doesn't care
|
41
|
-
return string
|
42
|
-
end
|
34
|
+
# Remove invalid and undefined UTF-8 character encodings
|
35
|
+
string.force_encoding('UTF-8')
|
36
|
+
string.chars.select{|i| i.valid_encoding?}.join
|
43
37
|
end
|
44
38
|
|
45
39
|
def log(logger)
|
@@ -25,6 +25,7 @@ module Beaker
|
|
25
25
|
@user = user
|
26
26
|
@ssh_opts = ssh_opts
|
27
27
|
@logger = options[:logger]
|
28
|
+
@options = options
|
28
29
|
end
|
29
30
|
|
30
31
|
def self.connect hostname, user = 'root', ssh_opts = {}, options = {}
|
@@ -57,6 +58,7 @@ module Beaker
|
|
57
58
|
self
|
58
59
|
end
|
59
60
|
|
61
|
+
# closes this SshConnection
|
60
62
|
def close
|
61
63
|
begin
|
62
64
|
@ssh.close if @ssh
|
data/lib/beaker/test_case.rb
CHANGED
@@ -6,18 +6,6 @@ require 'tempfile'
|
|
6
6
|
require 'benchmark'
|
7
7
|
require 'stringio'
|
8
8
|
require 'rbconfig'
|
9
|
-
#include test/unit, but do not allow it to autorun on exit
|
10
|
-
require 'test/unit'
|
11
|
-
if defined?(Test::Unit::AutoRunner.need_auto_run?)
|
12
|
-
# For test-unit gem >= 2.4.9
|
13
|
-
Test::Unit::AutoRunner.need_auto_run = false
|
14
|
-
elsif defined?(Test::Unit.run?)
|
15
|
-
# For test-unit gem < 2.4.9
|
16
|
-
Test::Unit.run = true
|
17
|
-
elsif defined?(Test::Unit::Runner)
|
18
|
-
# For test/unit bundled in Ruby >= 1.9.3
|
19
|
-
Test::Unit::Runner.module_eval("@@stop_auto_run = true")
|
20
|
-
end
|
21
9
|
|
22
10
|
module Beaker
|
23
11
|
# This class represents a single test case. A test case is necessarily
|
@@ -33,15 +21,8 @@ module Beaker
|
|
33
21
|
class TestCase
|
34
22
|
include Beaker::DSL
|
35
23
|
|
36
|
-
|
37
|
-
|
38
|
-
rb_config_class::CONFIG['MINOR'].to_i == 8 then
|
39
|
-
# The Exception raised by Ruby's STDLIB's test framework (Ruby 1.8)
|
40
|
-
TEST_EXCEPTION_CLASS = Test::Unit::AssertionFailedError
|
41
|
-
else
|
42
|
-
# The Exception raised by Ruby's STDLIB's test framework (Ruby 1.9)
|
43
|
-
TEST_EXCEPTION_CLASS = ::MiniTest::Assertion
|
44
|
-
end
|
24
|
+
# The Exception raised by Ruby's STDLIB's test framework (Ruby 1.9)
|
25
|
+
TEST_EXCEPTION_CLASS = ::MiniTest::Assertion
|
45
26
|
|
46
27
|
# Necessary for implementing {Beaker::DSL::Helpers#confine}.
|
47
28
|
# Assumed to be an array of valid {Beaker::Host} objects for
|
data/lib/beaker/test_suite.rb
CHANGED
@@ -341,7 +341,7 @@ module Beaker
|
|
341
341
|
start_time = Time.now
|
342
342
|
|
343
343
|
#Create a run log for this TestSuite.
|
344
|
-
run_log = log_path(
|
344
|
+
run_log = log_path("#{@name}-run.log", @options[:log_dated_dir])
|
345
345
|
@logger.add_destination(run_log)
|
346
346
|
|
347
347
|
# This is an awful hack to maintain backward compatibility until tests
|
@@ -379,8 +379,8 @@ module Beaker
|
|
379
379
|
# REVISIT: This changes global state, breaking logging in any future runs
|
380
380
|
# of the suite – or, at least, making them highly confusing for anyone who
|
381
381
|
# has not studied the implementation in detail. --daniel 2011-03-14
|
382
|
-
@test_suite_results.summarize( Logger.new(log_path(
|
383
|
-
@test_suite_results.write_junit_xml( log_path(@
|
382
|
+
@test_suite_results.summarize( Logger.new(log_path("#{name}-summary.txt", @options[:log_dated_dir]), STDOUT) )
|
383
|
+
@test_suite_results.write_junit_xml( log_path(@options[:xml_file], @options[:xml_dated_dir]), File.join(@options[:project_root], @options[:xml_stylesheet]) )
|
384
384
|
|
385
385
|
#All done with this run, remove run log
|
386
386
|
@logger.remove_destination(run_log)
|
@@ -404,32 +404,28 @@ module Beaker
|
|
404
404
|
end
|
405
405
|
end
|
406
406
|
|
407
|
-
#
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
#
|
412
|
-
#
|
413
|
-
#@example
|
414
|
-
# log_path('2014-06-02 16:31:22 -0700','output.txt', 'log')
|
407
|
+
# Gives a full file path for output to be written to, maintaining the latest symlink
|
408
|
+
# @param [String] name The file name that we want to write to.
|
409
|
+
# @param [String] log_dir The desired output directory.
|
410
|
+
# A symlink will be made from ./parentdir/latest to that.
|
411
|
+
# @example
|
412
|
+
# log_path('output.txt', 'log/2014-06-02_16_31_22')
|
415
413
|
#
|
416
|
-
#
|
414
|
+
# This will create the structure:
|
417
415
|
#
|
418
|
-
#
|
419
|
-
#
|
420
|
-
def log_path(
|
421
|
-
|
422
|
-
unless File.directory?(log_dir)
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
File.symlink(File.basename(log_dir), latest)
|
429
|
-
end
|
416
|
+
# ./log/2014-06-02_16_31_22/output.txt
|
417
|
+
# ./log/latest -> 2014-06-02_16_31_22
|
418
|
+
def log_path(name, log_dir)
|
419
|
+
log_parent_dir = File.dirname(log_dir)
|
420
|
+
FileUtils.mkdir_p(log_dir) unless File.directory?(log_dir)
|
421
|
+
|
422
|
+
latest = File.join(log_parent_dir, "latest")
|
423
|
+
if !File.exist?(latest) or File.symlink?(latest) then
|
424
|
+
File.delete(latest) if File.exist?(latest)
|
425
|
+
File.symlink(File.basename(log_dir), latest)
|
430
426
|
end
|
431
427
|
|
432
|
-
File.join(
|
428
|
+
File.join(log_parent_dir, 'latest', name)
|
433
429
|
end
|
434
430
|
|
435
431
|
end
|
data/lib/beaker/version.rb
CHANGED
data/spec/beaker/answers_spec.rb
CHANGED
@@ -65,6 +65,42 @@ module Beaker
|
|
65
65
|
@answers = answers.answers
|
66
66
|
end
|
67
67
|
|
68
|
+
it 'should add console services answers to dashboard answers' do
|
69
|
+
@ver = '3.4'
|
70
|
+
answers = @answers
|
71
|
+
expect( @answers['vm2'] ).to include :q_classifier_database_user => 'DFGhjlkj'
|
72
|
+
expect( @answers['vm2'] ).to include :q_classifier_database_name => 'pe-classifier'
|
73
|
+
expect( @answers['vm2'] ).to include :q_classifier_database_password => "'~!@\#$%^*-/ aZ'"
|
74
|
+
expect( @answers['vm2'] ).to include :q_activity_database_user => 'adsfglkj'
|
75
|
+
expect( @answers['vm2'] ).to include :q_activity_database_name => 'pe-activity'
|
76
|
+
expect( @answers['vm2'] ).to include :q_activity_database_password => "'~!@\#$%^*-/ aZ'"
|
77
|
+
expect( @answers['vm2'] ).to include :q_rbac_database_user => 'RbhNBklm'
|
78
|
+
expect( @answers['vm2'] ).to include :q_rbac_database_name => 'pe-rbac'
|
79
|
+
expect( @answers['vm2'] ).to include :q_rbac_database_password => "'~!@\#$%^*-/ aZ'"
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'should add console services answers to database answers' do
|
83
|
+
@ver = '3.4'
|
84
|
+
answers = @answers
|
85
|
+
expect( @answers['vm3'] ).to include :q_classifier_database_user => 'DFGhjlkj'
|
86
|
+
expect( @answers['vm3'] ).to include :q_classifier_database_name => 'pe-classifier'
|
87
|
+
expect( @answers['vm3'] ).to include :q_classifier_database_password => "'~!@\#$%^*-/ aZ'"
|
88
|
+
expect( @answers['vm3'] ).to include :q_activity_database_user => 'adsfglkj'
|
89
|
+
expect( @answers['vm3'] ).to include :q_activity_database_name => 'pe-activity'
|
90
|
+
expect( @answers['vm3'] ).to include :q_activity_database_password => "'~!@\#$%^*-/ aZ'"
|
91
|
+
expect( @answers['vm3'] ).to include :q_rbac_database_user => 'RbhNBklm'
|
92
|
+
expect( @answers['vm3'] ).to include :q_rbac_database_name => 'pe-rbac'
|
93
|
+
expect( @answers['vm3'] ).to include :q_rbac_database_password => "'~!@\#$%^*-/ aZ'"
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should add answers to the host objects' do
|
97
|
+
@ver = '3.4'
|
98
|
+
answers = @answers
|
99
|
+
hosts.each do |host|
|
100
|
+
expect( host[:answers] ).to be === answers[host.name]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
68
104
|
it 'should add answers to the host objects' do
|
69
105
|
hosts.each do |host|
|
70
106
|
expect( host[:answers] ).to be === @answers[host.name]
|
data/spec/beaker/cli_spec.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module Beaker
|
4
|
-
describe CLI
|
4
|
+
describe CLI do
|
5
5
|
let(:cli) { Beaker::CLI.new }
|
6
6
|
|
7
7
|
context 'execute!' do
|
8
8
|
before :each do
|
9
|
-
|
9
|
+
stub_const("Beaker::Logger", double().as_null_object )
|
10
10
|
File.open("sample.cfg", "w+") do |file|
|
11
11
|
file.write("HOSTS:\n")
|
12
12
|
file.write(" myhost:\n")
|
@@ -15,34 +15,34 @@ module Beaker
|
|
15
15
|
file.write(" platform: ubuntu-x-x\n")
|
16
16
|
file.write("CONFIG:\n")
|
17
17
|
end
|
18
|
-
cli.
|
19
|
-
cli.
|
20
|
-
cli.
|
18
|
+
allow( cli ).to receive(:setup).and_return(true)
|
19
|
+
allow( cli ).to receive(:validate).and_return(true)
|
20
|
+
allow( cli ).to receive(:provision).and_return(true)
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "test fail mode" do
|
24
24
|
it 'continues testing after failed test if using slow fail_mode' do
|
25
|
-
cli.
|
26
|
-
cli.
|
27
|
-
cli.
|
25
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
26
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_throw("bad test")
|
27
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
28
28
|
options = cli.instance_variable_get(:@options)
|
29
29
|
options[:fail_mode] = 'slow'
|
30
30
|
cli.instance_variable_set(:@options, options)
|
31
31
|
|
32
|
-
cli.
|
32
|
+
expect( cli ).to receive(:run_suite).exactly( 3 ).times
|
33
33
|
expect{ cli.execute! }.to raise_error
|
34
34
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'stops testing after failed test if using fast fail_mode' do
|
38
|
-
cli.
|
39
|
-
cli.
|
40
|
-
cli.
|
38
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
39
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_throw("bad test")
|
40
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
41
41
|
options = cli.instance_variable_get(:@options)
|
42
42
|
options[:fail_mode] = 'fast'
|
43
43
|
cli.instance_variable_set(:@options, options)
|
44
44
|
|
45
|
-
cli.
|
45
|
+
expect( cli ).to receive(:run_suite).exactly( 2 ).times
|
46
46
|
expect{ cli.execute! }.to raise_error
|
47
47
|
|
48
48
|
end
|
@@ -50,9 +50,9 @@ module Beaker
|
|
50
50
|
|
51
51
|
describe "SUT preserve mode" do
|
52
52
|
it 'cleans up SUTs post testing if tests fail and preserve_hosts = never' do
|
53
|
-
cli.
|
54
|
-
cli.
|
55
|
-
cli.
|
53
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
54
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_throw("bad test")
|
55
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
56
56
|
options = cli.instance_variable_get(:@options)
|
57
57
|
options[:fail_mode] = 'fast'
|
58
58
|
options[:preserve_hosts] = 'never'
|
@@ -60,16 +60,16 @@ module Beaker
|
|
60
60
|
|
61
61
|
netmanager = double(:netmanager)
|
62
62
|
cli.instance_variable_set(:@network_manager, netmanager)
|
63
|
-
netmanager.
|
63
|
+
expect( netmanager ).to receive(:cleanup).once
|
64
64
|
|
65
65
|
expect{ cli.execute! }.to raise_error
|
66
66
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'cleans up SUTs post testing if no tests fail and preserve_hosts = never' do
|
70
|
-
cli.
|
71
|
-
cli.
|
72
|
-
cli.
|
70
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
71
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_return(true)
|
72
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
73
73
|
options = cli.instance_variable_get(:@options)
|
74
74
|
options[:fail_mode] = 'fast'
|
75
75
|
options[:preserve_hosts] = 'never'
|
@@ -77,7 +77,7 @@ module Beaker
|
|
77
77
|
|
78
78
|
netmanager = double(:netmanager)
|
79
79
|
cli.instance_variable_set(:@network_manager, netmanager)
|
80
|
-
netmanager.
|
80
|
+
expect( netmanager ).to receive(:cleanup).once
|
81
81
|
|
82
82
|
expect{ cli.execute! }.to_not raise_error
|
83
83
|
|
@@ -85,9 +85,9 @@ module Beaker
|
|
85
85
|
|
86
86
|
|
87
87
|
it 'preserves SUTs post testing if no tests fail and preserve_hosts = always' do
|
88
|
-
cli.
|
89
|
-
cli.
|
90
|
-
cli.
|
88
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
89
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_return(true)
|
90
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
91
91
|
options = cli.instance_variable_get(:@options)
|
92
92
|
options[:fail_mode] = 'fast'
|
93
93
|
options[:preserve_hosts] = 'always'
|
@@ -95,16 +95,16 @@ module Beaker
|
|
95
95
|
|
96
96
|
netmanager = double(:netmanager)
|
97
97
|
cli.instance_variable_set(:@network_manager, netmanager)
|
98
|
-
netmanager.
|
98
|
+
expect( netmanager ).to receive(:cleanup).never
|
99
99
|
|
100
100
|
expect{ cli.execute! }.to_not raise_error
|
101
101
|
|
102
102
|
end
|
103
103
|
|
104
104
|
it 'preserves SUTs post testing if no tests fail and preserve_hosts = always' do
|
105
|
-
cli.
|
106
|
-
cli.
|
107
|
-
cli.
|
105
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
106
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_throw("bad test")
|
107
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
108
108
|
options = cli.instance_variable_get(:@options)
|
109
109
|
options[:fail_mode] = 'fast'
|
110
110
|
options[:preserve_hosts] = 'always'
|
@@ -112,15 +112,15 @@ module Beaker
|
|
112
112
|
|
113
113
|
netmanager = double(:netmanager)
|
114
114
|
cli.instance_variable_set(:@network_manager, netmanager)
|
115
|
-
netmanager.
|
115
|
+
expect( netmanager ).to receive(:cleanup).never
|
116
116
|
|
117
117
|
expect{ cli.execute! }.to raise_error
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'cleans up SUTs post testing if no tests fail and preserve_hosts = onfail' do
|
121
|
-
cli.
|
122
|
-
cli.
|
123
|
-
cli.
|
121
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
122
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_return(true)
|
123
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
124
124
|
options = cli.instance_variable_get(:@options)
|
125
125
|
options[:fail_mode] = 'fast'
|
126
126
|
options[:preserve_hosts] = 'onfail'
|
@@ -128,16 +128,16 @@ module Beaker
|
|
128
128
|
|
129
129
|
netmanager = double(:netmanager)
|
130
130
|
cli.instance_variable_set(:@network_manager, netmanager)
|
131
|
-
netmanager.
|
131
|
+
expect( netmanager ).to receive(:cleanup).once
|
132
132
|
|
133
133
|
expect{ cli.execute! }.to_not raise_error
|
134
134
|
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'preserves SUTs post testing if tests fail and preserve_hosts = onfail' do
|
138
|
-
cli.
|
139
|
-
cli.
|
140
|
-
cli.
|
138
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
139
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_throw("bad test")
|
140
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
141
141
|
options = cli.instance_variable_get(:@options)
|
142
142
|
options[:fail_mode] = 'fast'
|
143
143
|
options[:preserve_hosts] = 'onfail'
|
@@ -145,16 +145,16 @@ module Beaker
|
|
145
145
|
|
146
146
|
netmanager = double(:netmanager)
|
147
147
|
cli.instance_variable_set(:@network_manager, netmanager)
|
148
|
-
netmanager.
|
148
|
+
expect( netmanager ).to receive(:cleanup).never
|
149
149
|
|
150
150
|
expect{ cli.execute! }.to raise_error
|
151
151
|
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'cleans up SUTs post testing if tests fail and preserve_hosts = onpass' do
|
155
|
-
cli.
|
156
|
-
cli.
|
157
|
-
cli.
|
155
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
156
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_throw("bad test")
|
157
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
158
158
|
options = cli.instance_variable_get(:@options)
|
159
159
|
options[:fail_mode] = 'fast'
|
160
160
|
options[:preserve_hosts] = 'onpass'
|
@@ -162,16 +162,16 @@ module Beaker
|
|
162
162
|
|
163
163
|
netmanager = double(:netmanager)
|
164
164
|
cli.instance_variable_set(:@network_manager, netmanager)
|
165
|
-
netmanager.
|
165
|
+
expect( netmanager ).to receive(:cleanup).once
|
166
166
|
|
167
167
|
expect{ cli.execute! }.to raise_error
|
168
168
|
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'preserves SUTs post testing if no tests fail and preserve_hosts = onpass' do
|
172
|
-
cli.
|
173
|
-
cli.
|
174
|
-
cli.
|
172
|
+
allow( cli ).to receive(:run_suite).with(:pre_suite, :fast).and_return(true)
|
173
|
+
allow( cli ).to receive(:run_suite).with(:tests).and_return(true)
|
174
|
+
allow( cli ).to receive(:run_suite).with(:post_suite).and_return(true)
|
175
175
|
options = cli.instance_variable_get(:@options)
|
176
176
|
options[:fail_mode] = 'fast'
|
177
177
|
options[:preserve_hosts] = 'onpass'
|
@@ -179,7 +179,7 @@ module Beaker
|
|
179
179
|
|
180
180
|
netmanager = double(:netmanager)
|
181
181
|
cli.instance_variable_set(:@network_manager, netmanager)
|
182
|
-
netmanager.
|
182
|
+
expect( netmanager ).to receive(:cleanup).never
|
183
183
|
|
184
184
|
expect{ cli.execute! }.to_not raise_error
|
185
185
|
end
|