beaker 4.38.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/test.yml +36 -11
- data/.rubocop.yml +75 -0
- data/.rubocop_todo.yml +239 -0
- data/CHANGELOG.md +88 -33
- data/Gemfile +16 -4
- data/HISTORY.md +103 -0
- data/Rakefile +101 -112
- 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/Gemfile +1 -1
- data/acceptance/fixtures/module/Rakefile +3 -3
- data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +16 -23
- data/acceptance/fixtures/module/spec/classes/init_spec.rb +1 -2
- data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +3 -5
- data/acceptance/lib/helpers/test_helper.rb +7 -6
- 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 +7 -8
- 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 +9 -7
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +15 -21
- 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 +23 -30
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +3 -3
- 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 +21 -16
- data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +7 -7
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +30 -38
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +14 -18
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +8 -14
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +7 -11
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +5 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +4 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +8 -8
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +4 -6
- data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +14 -17
- data/acceptance/tests/base/dsl/structure_test.rb +9 -21
- data/acceptance/tests/base/host/file_test.rb +8 -8
- data/acceptance/tests/base/host/group_test.rb +2 -3
- data/acceptance/tests/base/host/host_test.rb +69 -66
- data/acceptance/tests/base/host/packages.rb +27 -30
- data/acceptance/tests/base/host/packages_unix.rb +0 -55
- data/acceptance/tests/base/host/user_test.rb +2 -3
- 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 +3 -5
- 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 +10 -14
- data/docs/concepts/argument_processing_and_precedence.md +1 -10
- data/docs/concepts/style_guide.md +1 -1
- data/docs/how_to/debug_beaker_tests.md +13 -13
- data/docs/how_to/hosts/eos.md +2 -12
- data/docs/how_to/install_puppet.md +0 -18
- data/docs/how_to/test_arbitrary_beaker_versions.md +2 -2
- data/docs/how_to/the_beaker_dsl.md +0 -2
- data/lib/beaker/cli.rb +63 -74
- data/lib/beaker/command.rb +22 -30
- data/lib/beaker/command_factory.rb +4 -3
- data/lib/beaker/dsl/assertions.rb +7 -19
- data/lib/beaker/dsl/helpers/hocon_helpers.rb +5 -9
- data/lib/beaker/dsl/helpers/host_helpers.rb +72 -133
- data/lib/beaker/dsl/helpers/test_helpers.rb +3 -5
- data/lib/beaker/dsl/helpers/web_helpers.rb +20 -28
- data/lib/beaker/dsl/helpers.rb +2 -4
- data/lib/beaker/dsl/outcomes.rb +17 -19
- data/lib/beaker/dsl/patterns.rb +1 -3
- data/lib/beaker/dsl/roles.rb +18 -21
- data/lib/beaker/dsl/structure.rb +55 -67
- 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 +3 -3
- data/lib/beaker/host/aix/user.rb +3 -3
- data/lib/beaker/host/aix.rb +3 -4
- data/lib/beaker/host/cisco.rb +36 -48
- 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 +5 -5
- data/lib/beaker/host/mac/group.rb +13 -13
- data/lib/beaker/host/mac/pkg.rb +6 -109
- data/lib/beaker/host/mac/user.rb +7 -7
- data/lib/beaker/host/mac.rb +8 -9
- data/lib/beaker/host/pswindows/exec.rb +70 -74
- data/lib/beaker/host/pswindows/file.rb +4 -6
- data/lib/beaker/host/pswindows/group.rb +5 -5
- data/lib/beaker/host/pswindows/pkg.rb +17 -17
- data/lib/beaker/host/pswindows/user.rb +4 -4
- data/lib/beaker/host/pswindows.rb +4 -3
- data/lib/beaker/host/unix/exec.rb +86 -88
- data/lib/beaker/host/unix/file.rb +41 -47
- data/lib/beaker/host/unix/group.rb +3 -3
- data/lib/beaker/host/unix/pkg.rb +158 -421
- data/lib/beaker/host/unix/user.rb +4 -4
- data/lib/beaker/host/unix.rb +18 -20
- data/lib/beaker/host/windows/exec.rb +20 -20
- data/lib/beaker/host/windows/file.rb +5 -5
- data/lib/beaker/host/windows/group.rb +5 -5
- data/lib/beaker/host/windows/pkg.rb +6 -57
- data/lib/beaker/host/windows/user.rb +4 -4
- data/lib/beaker/host/windows.rb +13 -13
- data/lib/beaker/host.rb +82 -139
- data/lib/beaker/host_prebuilt_steps.rb +121 -233
- data/lib/beaker/hypervisor/noop.rb +2 -4
- data/lib/beaker/hypervisor.rb +46 -63
- data/lib/beaker/local_connection.rb +4 -6
- data/lib/beaker/logger.rb +71 -85
- data/lib/beaker/logger_junit.rb +22 -26
- data/lib/beaker/network_manager.rb +40 -43
- data/lib/beaker/options/command_line_parser.rb +12 -23
- data/lib/beaker/options/hosts_file_parser.rb +34 -25
- data/lib/beaker/options/options_file_parser.rb +3 -6
- data/lib/beaker/options/options_hash.rb +3 -10
- data/lib/beaker/options/parser.rb +89 -105
- 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 +29 -34
- data/lib/beaker/platform.rb +38 -46
- 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 +40 -46
- data/lib/beaker/shared/options_resolver.rb +3 -7
- data/lib/beaker/shared/repetition.rb +6 -8
- data/lib/beaker/shared/semvar.rb +39 -43
- data/lib/beaker/shared/timed.rb +2 -5
- data/lib/beaker/shared.rb +1 -1
- data/lib/beaker/ssh_connection.rb +46 -55
- data/lib/beaker/subcommand.rb +23 -30
- data/lib/beaker/subcommands/subcommand_util.rb +4 -4
- data/lib/beaker/tasks/quick_start.rb +5 -10
- data/lib/beaker/tasks/rake_task.rb +26 -28
- data/lib/beaker/tasks/test.rb +4 -4
- data/lib/beaker/test_case.rb +15 -27
- data/lib/beaker/test_suite.rb +35 -39
- data/lib/beaker/test_suite_result.rb +52 -57
- data/lib/beaker/version.rb +1 -1
- data/lib/beaker.rb +5 -6
- data/spec/beaker/cli_spec.rb +135 -153
- data/spec/beaker/command_spec.rb +64 -58
- data/spec/beaker/dsl/assertions_spec.rb +38 -47
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +114 -135
- data/spec/beaker/dsl/helpers/test_helpers_spec.rb +9 -10
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +30 -36
- data/spec/beaker/dsl/outcomes_spec.rb +15 -14
- data/spec/beaker/dsl/roles_spec.rb +170 -132
- data/spec/beaker/dsl/structure_spec.rb +181 -163
- data/spec/beaker/dsl/test_tagging_spec.rb +94 -95
- data/spec/beaker/dsl/wrappers_spec.rb +39 -40
- data/spec/beaker/host/aix_spec.rb +14 -14
- data/spec/beaker/host/cisco_spec.rb +92 -102
- data/spec/beaker/host/eos_spec.rb +15 -36
- data/spec/beaker/host/freebsd/exec_spec.rb +5 -8
- data/spec/beaker/host/freebsd/pkg_spec.rb +29 -29
- data/spec/beaker/host/mac/exec_spec.rb +4 -5
- data/spec/beaker/host/mac/group_spec.rb +47 -56
- data/spec/beaker/host/mac/user_spec.rb +53 -62
- data/spec/beaker/host/pswindows/exec_spec.rb +36 -35
- data/spec/beaker/host/pswindows/file_spec.rb +21 -18
- data/spec/beaker/host/pswindows/user_spec.rb +17 -23
- data/spec/beaker/host/pswindows_spec.rb +14 -14
- data/spec/beaker/host/unix/exec_spec.rb +87 -92
- data/spec/beaker/host/unix/file_spec.rb +76 -82
- data/spec/beaker/host/unix/pkg_spec.rb +165 -407
- data/spec/beaker/host/unix_spec.rb +11 -207
- data/spec/beaker/host/windows/exec_spec.rb +32 -34
- data/spec/beaker/host/windows/file_spec.rb +22 -23
- data/spec/beaker/host/windows/group_spec.rb +17 -19
- data/spec/beaker/host/windows/pkg_spec.rb +10 -13
- 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 +193 -341
- data/spec/beaker/host_spec.rb +241 -312
- data/spec/beaker/hypervisor/hypervisor_spec.rb +38 -63
- data/spec/beaker/localhost_connection_spec.rb +14 -13
- data/spec/beaker/logger_junit_spec.rb +22 -34
- data/spec/beaker/logger_spec.rb +174 -155
- data/spec/beaker/network_manager_spec.rb +27 -27
- data/spec/beaker/options/command_line_parser_spec.rb +20 -23
- data/spec/beaker/options/data/hosts_preserved.yml +395 -0
- data/spec/beaker/options/hosts_file_parser_spec.rb +36 -31
- data/spec/beaker/options/options_file_parser_spec.rb +4 -7
- data/spec/beaker/options/options_hash_spec.rb +7 -9
- data/spec/beaker/options/parser_spec.rb +187 -187
- data/spec/beaker/options/presets_spec.rb +8 -10
- data/spec/beaker/options/subcommand_options_parser_spec.rb +15 -15
- data/spec/beaker/options/validator_spec.rb +27 -28
- data/spec/beaker/perf_spec.rb +32 -34
- data/spec/beaker/platform_spec.rb +27 -37
- data/spec/beaker/shared/error_handler_spec.rb +8 -17
- data/spec/beaker/shared/fog_credentials_spec.rb +30 -30
- data/spec/beaker/shared/host_manager_spec.rb +55 -89
- data/spec/beaker/shared/options_resolver_spec.rb +9 -12
- data/spec/beaker/shared/repetition_spec.rb +24 -31
- data/spec/beaker/shared/semvar_spec.rb +21 -26
- data/spec/beaker/ssh_connection_spec.rb +85 -90
- data/spec/beaker/subcommand/subcommand_util_spec.rb +40 -37
- data/spec/beaker/subcommand_spec.rb +89 -89
- data/spec/beaker/test_case_spec.rb +33 -62
- data/spec/beaker/test_suite_spec.rb +153 -160
- data/spec/helpers.rb +48 -53
- data/spec/matchers.rb +9 -8
- data/spec/mocks.rb +6 -11
- data/spec/spec_helper.rb +0 -4
- metadata +60 -85
- 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
- data/spec/mock_fission.rb +0 -60
- data/spec/mock_vsphere.rb +0 -314
- data/spec/mock_vsphere_helper.rb +0 -183
@@ -4,9 +4,9 @@ test_name "dsl::helpers::host_helpers #retry_on" do
|
|
4
4
|
step "#retry_on CURRENTLY fails with a RuntimeError if command does not pass after all retries" do
|
5
5
|
# NOTE: would have expected this to fail with Beaker::Hosts::CommandFailure
|
6
6
|
|
7
|
-
remote_tmpdir = default.tmpdir
|
7
|
+
remote_tmpdir = default.tmpdir
|
8
8
|
remote_script_file = File.join(remote_tmpdir, "test.sh")
|
9
|
-
|
9
|
+
create_remote_file_from_fixture("retry_script", default, remote_tmpdir, "test.sh")
|
10
10
|
|
11
11
|
assert_raises RuntimeError do
|
12
12
|
retry_on default, "bash #{remote_script_file} #{remote_tmpdir} 10", { :max_retries => 2, :retry_interval => 0.1 }
|
@@ -14,9 +14,9 @@ test_name "dsl::helpers::host_helpers #retry_on" do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
step "#retry_on succeeds if command passes before retries are exhausted" do
|
17
|
-
remote_tmpdir = default.tmpdir
|
17
|
+
remote_tmpdir = default.tmpdir
|
18
18
|
remote_script_file = File.join(remote_tmpdir, "test.sh")
|
19
|
-
|
19
|
+
create_remote_file_from_fixture("retry_script", default, remote_tmpdir, "test.sh")
|
20
20
|
|
21
21
|
result = retry_on default, "bash #{remote_script_file} #{remote_tmpdir} 2", { :max_retries => 4, :retry_interval => 0.1 }
|
22
22
|
assert_equal 0, result.exit_code
|
@@ -27,16 +27,16 @@ test_name "dsl::helpers::host_helpers #retry_on" do
|
|
27
27
|
# NOTE: would expect this to work across hosts, or be better documented and
|
28
28
|
# to raise Beaker::Host::CommandFailure
|
29
29
|
|
30
|
-
remote_tmpdir = default.tmpdir
|
30
|
+
remote_tmpdir = default.tmpdir
|
31
31
|
remote_script_file = File.join(remote_tmpdir, "test.sh")
|
32
32
|
|
33
33
|
hosts.each do |host|
|
34
34
|
on host, "mkdir -p #{remote_tmpdir}"
|
35
|
-
|
35
|
+
create_remote_file_from_fixture("retry_script", host, remote_tmpdir, "test.sh")
|
36
36
|
end
|
37
37
|
|
38
38
|
assert_raises NoMethodError do
|
39
|
-
|
39
|
+
retry_on hosts, "bash #{remote_script_file} #{remote_tmpdir} 2", { :max_retries => 4, :retry_interval => 0.1 }
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -2,7 +2,6 @@ require "helpers/test_helper"
|
|
2
2
|
require "rsync"
|
3
3
|
|
4
4
|
test_name "dsl::helpers::host_helpers #rsync_to" do
|
5
|
-
|
6
5
|
def rsync_to_with_backups hosts, local_filename, remote_dir
|
7
6
|
result = nil
|
8
7
|
repeat_fibonacci_style_for(10) do
|
@@ -12,14 +11,10 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
12
11
|
) # return of block is whether or not we're done repeating
|
13
12
|
return result.success? if result.is_a? Rsync::Result
|
14
13
|
|
15
|
-
result.
|
16
|
-
|
17
|
-
return false
|
18
|
-
end
|
19
|
-
true
|
20
|
-
rescue Beaker::Host::CommandFailure => err
|
14
|
+
result.all? { |individual_result| individual_result.success? }
|
15
|
+
rescue Beaker::Host::CommandFailure => e
|
21
16
|
logger.info("create_remote_file threw command failure, details: ")
|
22
|
-
logger.info(" #{
|
17
|
+
logger.info(" #{e}")
|
23
18
|
logger.info("continuing back-off execution")
|
24
19
|
false
|
25
20
|
end
|
@@ -29,15 +24,14 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
29
24
|
|
30
25
|
# NOTE: there does not seem to be a reliable way to confine to cygwin hosts.
|
31
26
|
confine_block :to, :platform => /windows/ do
|
32
|
-
|
33
27
|
# NOTE: rsync works fine on Windows as long as you use POSIX-style paths.
|
34
28
|
# However, these tests use Host#tmpdir which outputs mixed-style paths
|
35
29
|
# e.g. C:/cygwin64/tmp/beaker.Rp9G6L - Fix me with BKR-1503
|
36
30
|
|
37
31
|
step "#rsync_to CURRENTLY fails on windows systems" do
|
38
32
|
Dir.mktmpdir do |local_dir|
|
39
|
-
local_filename,
|
40
|
-
remote_tmpdir = default.tmpdir
|
33
|
+
local_filename, _contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
34
|
+
remote_tmpdir = default.tmpdir
|
41
35
|
|
42
36
|
assert_raises Beaker::Host::CommandFailure do
|
43
37
|
rsync_to default, local_filename, remote_tmpdir
|
@@ -45,7 +39,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
45
39
|
|
46
40
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
47
41
|
assert_raises Beaker::Host::CommandFailure do
|
48
|
-
|
42
|
+
on(default, "cat #{remote_filename}").stdout
|
49
43
|
end
|
50
44
|
end
|
51
45
|
end
|
@@ -56,8 +50,11 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
56
50
|
# However, these tests use Host#tmpdir which outputs mixed-style paths
|
57
51
|
# e.g. C:/cygwin64/tmp/beaker.Rp9G6L - Fix me with BKR-1503
|
58
52
|
|
53
|
+
# rsync is broken on beaker-docker
|
54
|
+
confine :except, :hypervisor => 'docker'
|
55
|
+
|
59
56
|
step "#rsync_to fails if the local file cannot be found" do
|
60
|
-
remote_tmpdir = default.tmpdir
|
57
|
+
remote_tmpdir = default.tmpdir
|
61
58
|
assert_raises IOError do
|
62
59
|
rsync_to default, "/non/existent/file.txt", remote_tmpdir
|
63
60
|
end
|
@@ -73,7 +70,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
73
70
|
rsync_package = "rsync"
|
74
71
|
# solaris-10 uses OpenCSW pkgutil, which prepends "CSW" to its provided packages
|
75
72
|
# TODO: fix this with BKR-1502
|
76
|
-
rsync_package = "CSWrsync" if host['platform']
|
73
|
+
rsync_package = "CSWrsync" if host['platform'].include?('solaris-10')
|
77
74
|
host.uninstall_package rsync_package
|
78
75
|
else
|
79
76
|
host[:rsync_installed] = false
|
@@ -84,11 +81,10 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
84
81
|
# rsync is preinstalled on OSX
|
85
82
|
step "#rsync_to fails if rsync is not installed on the remote host" do
|
86
83
|
Dir.mktmpdir do |local_dir|
|
87
|
-
local_filename,
|
84
|
+
local_filename, _contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
88
85
|
|
89
86
|
hosts.each do |host|
|
90
87
|
remote_tmpdir = host.tmpdir("beaker")
|
91
|
-
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
92
88
|
|
93
89
|
assert_raises Beaker::Host::CommandFailure do
|
94
90
|
rsync_to default, local_filename, remote_tmpdir
|
@@ -106,7 +102,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
106
102
|
|
107
103
|
step "#rsync_to fails if the remote path cannot be found" do
|
108
104
|
Dir.mktmpdir do |local_dir|
|
109
|
-
local_filename,
|
105
|
+
local_filename, _contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
110
106
|
|
111
107
|
assert_raises Beaker::Host::CommandFailure do
|
112
108
|
rsync_to default, local_filename, "/non/existent/testfile.txt"
|
@@ -120,21 +116,19 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
120
116
|
step "#rsync_to creates the file on the remote system" do
|
121
117
|
Dir.mktmpdir do |local_dir|
|
122
118
|
local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
123
|
-
remote_tmpdir = default.tmpdir
|
119
|
+
remote_tmpdir = default.tmpdir
|
124
120
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
125
121
|
|
126
122
|
result = rsync_to_with_backups default, local_filename, remote_tmpdir
|
127
123
|
|
128
124
|
fails_intermittently("https://tickets.puppetlabs.com/browse/QENG-3053",
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
"result" => result.inspect,
|
137
|
-
) do
|
125
|
+
"default" => default,
|
126
|
+
"contents" => contents,
|
127
|
+
"local_filename" => local_filename,
|
128
|
+
"local_dir" => local_dir,
|
129
|
+
"remote_filename" => remote_filename,
|
130
|
+
"remote_tmdir" => remote_tmpdir,
|
131
|
+
"result" => result.inspect) do
|
138
132
|
remote_contents = on(default, "cat #{remote_filename}").stdout
|
139
133
|
assert_equal contents, remote_contents
|
140
134
|
end
|
@@ -144,7 +138,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
144
138
|
step "#rsync_to creates the file on all remote systems when a host array is provided" do
|
145
139
|
Dir.mktmpdir do |local_dir|
|
146
140
|
local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
147
|
-
remote_tmpdir = default.tmpdir
|
141
|
+
remote_tmpdir = default.tmpdir
|
148
142
|
on hosts, "mkdir -p #{remote_tmpdir}"
|
149
143
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
150
144
|
|
@@ -152,15 +146,13 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
152
146
|
|
153
147
|
hosts.each do |host|
|
154
148
|
fails_intermittently("https://tickets.puppetlabs.com/browse/QENG-3053",
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
"result" => result.inspect,
|
163
|
-
) do
|
149
|
+
"host" => host,
|
150
|
+
"contents" => contents,
|
151
|
+
"local_filename" => local_filename,
|
152
|
+
"local_dir" => local_dir,
|
153
|
+
"remote_filename" => remote_filename,
|
154
|
+
"remote_tmdir" => remote_tmpdir,
|
155
|
+
"result" => result.inspect) do
|
164
156
|
remote_contents = on(host, "cat #{remote_filename}").stdout
|
165
157
|
assert_equal contents, remote_contents
|
166
158
|
end
|
@@ -178,7 +170,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
178
170
|
rsync_package = "rsync"
|
179
171
|
# solaris-10 uses OpenCSW pkgutil, which prepends "CSW" to its provided packages
|
180
172
|
# TODO: fix this with BKR-1502
|
181
|
-
rsync_package = "CSWrsync" if host['platform']
|
173
|
+
rsync_package = "CSWrsync" if host['platform'].include?('solaris-10')
|
182
174
|
host.uninstall_package rsync_package
|
183
175
|
end
|
184
176
|
host.delete(:rsync_installed)
|
@@ -1,9 +1,7 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #run_cron_on" do
|
4
|
-
|
5
4
|
confine_block :to, :platform => /windows/ do
|
6
|
-
|
7
5
|
step "#run_cron_on fails on windows platforms when listing cron jobs for a user on a host" do
|
8
6
|
assert_raises Beaker::Host::CommandFailure do
|
9
7
|
run_cron_on default, :list, default['user']
|
@@ -12,7 +10,6 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
12
10
|
end
|
13
11
|
|
14
12
|
confine_block :to, :platform => /solaris/ do
|
15
|
-
|
16
13
|
step "#run_cron_on CURRENTLY does nothing and returns `nil` when an unknown command is provided" do
|
17
14
|
# NOTE: would have expected this to raise Beaker::Host::CommandFailure instead
|
18
15
|
|
@@ -39,7 +36,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
39
36
|
end
|
40
37
|
|
41
38
|
step "#run_cron_on CURRENTLY does not fail, but returns nil, when adding cron jobs for an unknown user" do
|
42
|
-
result = run_cron_on default, :add, "nonexistentuser", %
|
39
|
+
result = run_cron_on default, :add, "nonexistentuser", %{* * * * * /bin/echo "hello" >/dev/null}
|
43
40
|
assert_nil result
|
44
41
|
end
|
45
42
|
|
@@ -49,7 +46,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
49
46
|
end
|
50
47
|
|
51
48
|
step "#run_cron_on can add a cron job for a user on a host" do
|
52
|
-
run_cron_on default, :add, default['user'], %
|
49
|
+
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "hello" >/dev/null}
|
53
50
|
result = run_cron_on default, :list, default['user']
|
54
51
|
assert_equal 0, result.exit_code
|
55
52
|
assert_match %r{/bin/echo}, result.stdout
|
@@ -60,13 +57,13 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
60
57
|
# cron entries. See also: https://github.com/puppetlabs/beaker/pull/937#discussion_r38338494
|
61
58
|
|
62
59
|
1.upto(3) do |job_number|
|
63
|
-
run_cron_on default, :add, default['user'], %
|
60
|
+
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "job :#{job_number}:" >/dev/null}
|
64
61
|
end
|
65
62
|
|
66
63
|
result = run_cron_on default, :list, default['user']
|
67
64
|
|
68
|
-
|
69
|
-
|
65
|
+
refute_match %r{job :1:}, result.stdout
|
66
|
+
refute_match %r{job :2:}, result.stdout
|
70
67
|
assert_match %r{job :3:}, result.stdout
|
71
68
|
end
|
72
69
|
|
@@ -74,7 +71,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
74
71
|
# NOTE: would have expected a more granular approach to removing cron jobs
|
75
72
|
# for a user on a host. This should otherwise be better documented.
|
76
73
|
|
77
|
-
run_cron_on default, :add, default['user'], %
|
74
|
+
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "quality: job 1" >/dev/null}
|
78
75
|
result = run_cron_on default, :list, default['user']
|
79
76
|
assert_match %r{quality: job 1}, result.stdout
|
80
77
|
|
@@ -118,14 +115,13 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
118
115
|
|
119
116
|
hosts.each do |host|
|
120
117
|
assert_raises Beaker::Host::CommandFailure do
|
121
|
-
|
118
|
+
run_cron_on host, :list, host['user']
|
122
119
|
end
|
123
120
|
end
|
124
121
|
end
|
125
122
|
end
|
126
123
|
|
127
124
|
confine_block :except, :platform => /windows|solaris/ do
|
128
|
-
|
129
125
|
step "#run_cron_on CURRENTLY does nothing and returns `nil` when an unknown command is provided" do
|
130
126
|
# NOTE: would have expected this to raise Beaker::Host::CommandFailure instead
|
131
127
|
|
@@ -154,7 +150,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
154
150
|
|
155
151
|
step "#run_cron_on fails when adding cron jobs for an unknown user" do
|
156
152
|
assert_raises Beaker::Host::CommandFailure do
|
157
|
-
run_cron_on default, :add, "nonexistentuser", %
|
153
|
+
run_cron_on default, :add, "nonexistentuser", %{* * * * * /bin/echo "hello" >/dev/null}
|
158
154
|
end
|
159
155
|
end
|
160
156
|
|
@@ -165,7 +161,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
165
161
|
end
|
166
162
|
|
167
163
|
step "#run_cron_on can add a cron job for a user on a host" do
|
168
|
-
run_cron_on default, :add, default['user'], %
|
164
|
+
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "hello" >/dev/null}
|
169
165
|
result = run_cron_on default, :list, default['user']
|
170
166
|
assert_equal 0, result.exit_code
|
171
167
|
assert_match %r{/bin/echo}, result.stdout
|
@@ -176,13 +172,13 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
176
172
|
# cron entries. See also: https://github.com/puppetlabs/beaker/pull/937#discussion_r38338494
|
177
173
|
|
178
174
|
1.upto(3) do |job_number|
|
179
|
-
run_cron_on default, :add, default['user'], %
|
175
|
+
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "job :#{job_number}:" >/dev/null}
|
180
176
|
end
|
181
177
|
|
182
178
|
result = run_cron_on default, :list, default['user']
|
183
179
|
|
184
|
-
|
185
|
-
|
180
|
+
refute_match %r{job :1:}, result.stdout
|
181
|
+
refute_match %r{job :2:}, result.stdout
|
186
182
|
assert_match %r{job :3:}, result.stdout
|
187
183
|
end
|
188
184
|
|
@@ -190,7 +186,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
190
186
|
# NOTE: would have expected a more granular approach to removing cron jobs
|
191
187
|
# for a user on a host. This should otherwise be better documented.
|
192
188
|
|
193
|
-
run_cron_on default, :add, default['user'], %
|
189
|
+
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "quality: job 1" >/dev/null}
|
194
190
|
result = run_cron_on default, :list, default['user']
|
195
191
|
assert_match %r{quality: job 1}, result.stdout
|
196
192
|
|
@@ -234,7 +230,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
234
230
|
|
235
231
|
hosts.each do |host|
|
236
232
|
assert_raises Beaker::Host::CommandFailure do
|
237
|
-
|
233
|
+
run_cron_on host, :list, host['user']
|
238
234
|
end
|
239
235
|
end
|
240
236
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #run_script_on" do
|
4
|
-
|
5
4
|
step "#run_script_on fails when the local script cannot be found" do
|
6
5
|
assert_raises IOError do
|
7
6
|
run_script_on default, "/non/existent/testfile.sh"
|
@@ -10,8 +9,7 @@ test_name "dsl::helpers::host_helpers #run_script_on" do
|
|
10
9
|
|
11
10
|
step "#run_script_on fails when there is an error running the remote script" do
|
12
11
|
Dir.mktmpdir do |local_dir|
|
13
|
-
local_filename =
|
14
|
-
local_filename, contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
12
|
+
local_filename, _contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
15
13
|
|
16
14
|
assert_raises Beaker::Host::CommandFailure do
|
17
15
|
run_script_on default, local_filename
|
@@ -21,8 +19,7 @@ test_name "dsl::helpers::host_helpers #run_script_on" do
|
|
21
19
|
|
22
20
|
step "#run_script_on passes along options when running the remote command" do
|
23
21
|
Dir.mktmpdir do |local_dir|
|
24
|
-
local_filename =
|
25
|
-
local_filename, contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
22
|
+
local_filename, _contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
26
23
|
|
27
24
|
result = run_script_on default, local_filename, { :accept_all_exit_codes => true }
|
28
25
|
assert_equal 1, result.exit_code
|
@@ -31,8 +28,7 @@ test_name "dsl::helpers::host_helpers #run_script_on" do
|
|
31
28
|
|
32
29
|
step "#run_script_on runs the script on the remote host" do
|
33
30
|
Dir.mktmpdir do |local_dir|
|
34
|
-
local_filename =
|
35
|
-
local_filename, contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
31
|
+
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
36
32
|
|
37
33
|
results = run_script_on default, local_filename
|
38
34
|
assert_equal 0, results.exit_code
|
@@ -42,20 +38,18 @@ test_name "dsl::helpers::host_helpers #run_script_on" do
|
|
42
38
|
|
43
39
|
step "#run_script_on allows assertions in an optional block" do
|
44
40
|
Dir.mktmpdir do |local_dir|
|
45
|
-
local_filename =
|
46
|
-
local_filename, contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
41
|
+
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
47
42
|
|
48
|
-
|
49
|
-
assert_equal 0, exit_code
|
50
|
-
assert_equal "output\n", stdout
|
43
|
+
run_script_on default, local_filename do |result|
|
44
|
+
assert_equal 0, result.exit_code
|
45
|
+
assert_equal "output\n", result.stdout
|
51
46
|
end
|
52
47
|
end
|
53
48
|
end
|
54
49
|
|
55
50
|
step "#run_script_on runs the script on all remote hosts when a host array is provided" do
|
56
51
|
Dir.mktmpdir do |local_dir|
|
57
|
-
local_filename =
|
58
|
-
local_filename, contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
52
|
+
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
59
53
|
|
60
54
|
results = run_script_on hosts, local_filename
|
61
55
|
|
@@ -9,8 +9,7 @@ test_name "dsl::helpers::host_helpers #run_script" do
|
|
9
9
|
|
10
10
|
step "#run_script fails when there is an error running the remote script" do
|
11
11
|
Dir.mktmpdir do |local_dir|
|
12
|
-
local_filename =
|
13
|
-
local_filename, contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
12
|
+
local_filename, _contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
14
13
|
|
15
14
|
assert_raises Beaker::Host::CommandFailure do
|
16
15
|
run_script local_filename
|
@@ -20,8 +19,7 @@ test_name "dsl::helpers::host_helpers #run_script" do
|
|
20
19
|
|
21
20
|
step "#run_script passes along options when running the remote command" do
|
22
21
|
Dir.mktmpdir do |local_dir|
|
23
|
-
local_filename =
|
24
|
-
local_filename, contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
22
|
+
local_filename, _contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
25
23
|
|
26
24
|
result = run_script local_filename, { :accept_all_exit_codes => true }
|
27
25
|
assert_equal 1, result.exit_code
|
@@ -30,8 +28,7 @@ test_name "dsl::helpers::host_helpers #run_script" do
|
|
30
28
|
|
31
29
|
step "#run_script runs the script on the remote host" do
|
32
30
|
Dir.mktmpdir do |local_dir|
|
33
|
-
local_filename =
|
34
|
-
local_filename, contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
31
|
+
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
35
32
|
|
36
33
|
results = run_script local_filename
|
37
34
|
assert_equal 0, results.exit_code
|
@@ -41,12 +38,11 @@ test_name "dsl::helpers::host_helpers #run_script" do
|
|
41
38
|
|
42
39
|
step "#run_script allows assertions in an optional block" do
|
43
40
|
Dir.mktmpdir do |local_dir|
|
44
|
-
local_filename =
|
45
|
-
local_filename, contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
41
|
+
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
46
42
|
|
47
|
-
|
48
|
-
assert_equal 0, exit_code
|
49
|
-
assert_equal "output\n", stdout
|
43
|
+
run_script local_filename do |result|
|
44
|
+
assert_equal 0, result.exit_code
|
45
|
+
assert_equal "output\n", result.stdout
|
50
46
|
end
|
51
47
|
end
|
52
48
|
end
|
@@ -3,8 +3,8 @@ require "helpers/test_helper"
|
|
3
3
|
test_name "dsl::helpers::host_helpers #scp_from" do
|
4
4
|
if test_scp_error_on_close?
|
5
5
|
step "#scp_from fails if the local path cannot be found" do
|
6
|
-
remote_tmpdir = default.tmpdir
|
7
|
-
remote_filename,
|
6
|
+
remote_tmpdir = default.tmpdir
|
7
|
+
remote_filename, _contents = create_remote_file_from_fixture("simple_text_file", default, remote_tmpdir, "testfile.txt")
|
8
8
|
|
9
9
|
assert_raises Beaker::Host::CommandFailure do
|
10
10
|
scp_from default, remote_filename, "/non/existent/file.txt"
|
@@ -22,7 +22,7 @@ test_name "dsl::helpers::host_helpers #scp_from" do
|
|
22
22
|
|
23
23
|
step "#scp_from creates the file on the local system" do
|
24
24
|
Dir.mktmpdir do |local_dir|
|
25
|
-
remote_tmpdir = default.tmpdir
|
25
|
+
remote_tmpdir = default.tmpdir
|
26
26
|
remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_tmpdir, "testfile.txt")
|
27
27
|
|
28
28
|
scp_from default, remote_filename, local_dir
|
@@ -37,10 +37,10 @@ test_name "dsl::helpers::host_helpers #scp_from" do
|
|
37
37
|
# file repeatedly to generate an error
|
38
38
|
|
39
39
|
Dir.mktmpdir do |local_dir|
|
40
|
-
remote_tmpdir = default.tmpdir
|
40
|
+
remote_tmpdir = default.tmpdir
|
41
41
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
42
42
|
on hosts, "mkdir -p #{remote_tmpdir}"
|
43
|
-
|
43
|
+
on hosts, %{echo "${RANDOM}:${RANDOM}:${RANDOM}" > #{remote_filename}}
|
44
44
|
|
45
45
|
scp_from hosts, remote_filename, local_dir
|
46
46
|
remote_contents = on(hosts.last, "cat #{remote_filename}").stdout
|
@@ -2,7 +2,7 @@ require "helpers/test_helper"
|
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #scp_to" do
|
4
4
|
step "#scp_to fails if the local file cannot be found" do
|
5
|
-
remote_tmpdir = default.tmpdir
|
5
|
+
remote_tmpdir = default.tmpdir
|
6
6
|
assert_raises IOError do
|
7
7
|
scp_to default, "/non/existent/file.txt", remote_tmpdir
|
8
8
|
end
|
@@ -11,7 +11,7 @@ test_name "dsl::helpers::host_helpers #scp_to" do
|
|
11
11
|
if test_scp_error_on_close?
|
12
12
|
step "#scp_to fails if the remote path cannot be found" do
|
13
13
|
Dir.mktmpdir do |local_dir|
|
14
|
-
local_filename,
|
14
|
+
local_filename, _contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
15
15
|
|
16
16
|
# assert_raises Beaker::Host::CommandFailure do
|
17
17
|
assert_raises RuntimeError do
|
@@ -24,7 +24,7 @@ test_name "dsl::helpers::host_helpers #scp_to" do
|
|
24
24
|
step "#scp_to creates the file on the remote system" do
|
25
25
|
Dir.mktmpdir do |local_dir|
|
26
26
|
local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
27
|
-
remote_tmpdir = default.tmpdir
|
27
|
+
remote_tmpdir = default.tmpdir
|
28
28
|
|
29
29
|
scp_to default, local_filename, remote_tmpdir
|
30
30
|
|
@@ -38,7 +38,7 @@ test_name "dsl::helpers::host_helpers #scp_to" do
|
|
38
38
|
Dir.mktmpdir do |local_dir|
|
39
39
|
local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
40
40
|
|
41
|
-
remote_tmpdir = default.tmpdir
|
41
|
+
remote_tmpdir = default.tmpdir
|
42
42
|
on hosts, "mkdir -p #{remote_tmpdir}"
|
43
43
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
44
44
|
|
@@ -50,5 +50,4 @@ test_name "dsl::helpers::host_helpers #scp_to" do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
|
-
|
54
53
|
end
|
@@ -8,31 +8,31 @@ test_name "dsl::helpers::host_helpers #shell" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
step "#shell makes command output available via `.stdout` on success" do
|
11
|
-
output = shell(%
|
11
|
+
output = shell(%{echo "echo via on"}).stdout
|
12
12
|
assert_equal "echo via on\n", output
|
13
13
|
end
|
14
14
|
|
15
15
|
step "#shell makes command error output available via `.stderr` on success" do
|
16
16
|
output = shell("/bin/nonexistent-command", :acceptable_exit_codes => [0, 127]).stderr
|
17
|
-
assert_match
|
17
|
+
assert_match(/No such file/, output)
|
18
18
|
end
|
19
19
|
|
20
20
|
step "#shell makes exit status available via `.exit_code`" do
|
21
|
-
status = shell(%
|
21
|
+
status = shell(%{echo "echo via on"}).exit_code
|
22
22
|
assert_equal 0, status
|
23
23
|
end
|
24
24
|
|
25
25
|
step "#shell with :acceptable_exit_codes will not fail for named exit codes" do
|
26
26
|
result = shell "/bin/nonexistent-command", :acceptable_exit_codes => [0, 127]
|
27
27
|
output = result.stderr
|
28
|
-
assert_match
|
28
|
+
assert_match(/No such file/, output)
|
29
29
|
status = result.exit_code
|
30
30
|
assert_equal 127, status
|
31
31
|
end
|
32
32
|
|
33
33
|
step "#shell with :acceptable_exit_codes will fail for other exit codes" do
|
34
34
|
assert_raises(Beaker::Host::CommandFailure) do
|
35
|
-
shell %
|
35
|
+
shell %{echo "echo via on"}, :acceptable_exit_codes => [127]
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -40,12 +40,12 @@ test_name "dsl::helpers::host_helpers #shell" do
|
|
40
40
|
result = shell "env", { :environment => { 'FOO' => 'bar' } }
|
41
41
|
output = result.stdout
|
42
42
|
|
43
|
-
assert_match
|
43
|
+
assert_match(/\bFOO=bar\b/, output)
|
44
44
|
end
|
45
45
|
|
46
46
|
step "#shell allows assertions to be used in the optional block" do
|
47
|
-
shell %
|
48
|
-
assert_match
|
47
|
+
shell %{echo "${RANDOM}:${RANDOM}"} do |result|
|
48
|
+
assert_match(/\d+:\d+/, result.stdout)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #upgrade_package" do
|
4
|
-
|
5
4
|
# NOTE: there does not appear to be a way to confine just to cygwin hosts
|
6
5
|
confine_block :to, :platform => /windows/ do
|
7
|
-
|
8
6
|
# NOTE: check_for_package on windows currently fails as follows:
|
9
7
|
#
|
10
8
|
# ArgumentError: wrong number of arguments (3 for 1..2)
|
@@ -20,7 +18,6 @@ test_name "dsl::helpers::host_helpers #upgrade_package" do
|
|
20
18
|
end
|
21
19
|
|
22
20
|
confine_block :to, :platform => /osx/ do
|
23
|
-
|
24
21
|
step "#upgrade_package CURRENTLY fails with a RuntimeError on OS X" do
|
25
22
|
# NOTE: documentation could be better on this method
|
26
23
|
assert_raises RuntimeError do
|
@@ -30,8 +27,10 @@ test_name "dsl::helpers::host_helpers #upgrade_package" do
|
|
30
27
|
end
|
31
28
|
|
32
29
|
confine_block :except, :platform => /windows|osx/ do
|
33
|
-
|
30
|
+
# rsync is broken on beaker-docker
|
31
|
+
confine :except, :hypervisor => 'docker'
|
34
32
|
|
33
|
+
confine_block :to, :platform => /centos|el-\d/ do
|
35
34
|
step "#upgrade_package CURRENTLY does not fail on CentOS if unknown package is specified" do
|
36
35
|
# NOTE: I would expect this to fail with an Beaker::Host::CommandFailure,
|
37
36
|
# but maybe it's because yum doesn't really care:
|
@@ -43,12 +42,11 @@ test_name "dsl::helpers::host_helpers #upgrade_package" do
|
|
43
42
|
# > No Packages marked for Update
|
44
43
|
|
45
44
|
result = upgrade_package default, "non-existent-package-name"
|
46
|
-
assert_match
|
45
|
+
assert_match(/No Packages marked for Update/i, result)
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
50
49
|
confine_block :except, :platform => /centos|el-\d/ do
|
51
|
-
|
52
50
|
step "#upgrade_package fails if package is not already installed" do
|
53
51
|
assert_raises Beaker::Host::CommandFailure do
|
54
52
|
upgrade_package default, "non-existent-package-name"
|