beaker 4.40.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 +26 -13
- data/.rubocop.yml +23 -10
- data/.rubocop_todo.yml +34 -10
- data/CHANGELOG.md +13 -11
- data/Gemfile +12 -7
- 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 +4 -3
- 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 +80 -82
- data/lib/beaker/host/unix/file.rb +38 -43
- data/lib/beaker/host/unix/group.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +154 -417
- 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 +93 -198
- 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 -24
- 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 +22 -27
- 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 +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 +15 -27
- 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 +5 -6
- 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 +169 -158
- 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 +47 -56
- data/spec/beaker/host/mac/user_spec.rb +53 -62
- 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 -73
- data/spec/beaker/host/unix/pkg_spec.rb +155 -401
- 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 +172 -326
- 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 -36
- 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 +48 -53
- data/spec/matchers.rb +8 -7
- data/spec/mocks.rb +1 -6
- data/spec/spec_helper.rb +0 -1
- metadata +7 -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
@@ -3,14 +3,14 @@ require "helpers/test_helper"
|
|
3
3
|
test_name "dsl::helpers::host_helpers #backup_the_file" do
|
4
4
|
step "#backup_the_file CURRENTLY will return nil if the file does not exist in the source directory" do
|
5
5
|
# NOTE: would expect this to fail with Beaker::Host::CommandFailure
|
6
|
-
remote_source = default.tmpdir
|
7
|
-
remote_destination = default.tmpdir
|
6
|
+
remote_source = default.tmpdir
|
7
|
+
remote_destination = default.tmpdir
|
8
8
|
result = backup_the_file default, remote_source, remote_destination
|
9
9
|
assert_nil result
|
10
10
|
end
|
11
11
|
|
12
12
|
step "#backup_the_file will fail if the destination directory does not exist" do
|
13
|
-
remote_source = default.tmpdir
|
13
|
+
remote_source = default.tmpdir
|
14
14
|
create_remote_file_from_fixture("simple_text_file", default, remote_source, "puppet.conf")
|
15
15
|
|
16
16
|
assert_raises Beaker::Host::CommandFailure do
|
@@ -19,10 +19,10 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
step "#backup_the_file copies `puppet.conf` from the source to the destination directory" do
|
22
|
-
remote_source = default.tmpdir
|
22
|
+
remote_source = default.tmpdir
|
23
23
|
_remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_source, "puppet.conf")
|
24
24
|
|
25
|
-
remote_destination = default.tmpdir
|
25
|
+
remote_destination = default.tmpdir
|
26
26
|
remote_destination_filename = File.join(remote_destination, "puppet.conf.bak")
|
27
27
|
|
28
28
|
result = backup_the_file default, remote_source, remote_destination
|
@@ -33,10 +33,10 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
step "#backup_the_file copies a named file from the source to the destination directory" do
|
36
|
-
remote_source = default.tmpdir
|
36
|
+
remote_source = default.tmpdir
|
37
37
|
_remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_source, "testfile.txt")
|
38
38
|
|
39
|
-
remote_destination = default.tmpdir
|
39
|
+
remote_destination = default.tmpdir
|
40
40
|
remote_destination_filename = File.join(remote_destination, "testfile.txt.bak")
|
41
41
|
|
42
42
|
result = backup_the_file default, remote_source, remote_destination, "testfile.txt"
|
@@ -47,9 +47,9 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
step "#backup_the_file CURRENTLY will fail if given a hosts array" do
|
50
|
-
remote_source = default.tmpdir
|
50
|
+
remote_source = default.tmpdir
|
51
51
|
create_remote_file_from_fixture("simple_text_file", default, remote_source, "testfile.txt")
|
52
|
-
remote_destination = default.tmpdir
|
52
|
+
remote_destination = default.tmpdir
|
53
53
|
|
54
54
|
assert_raises NoMethodError do
|
55
55
|
backup_the_file hosts, remote_source, remote_destination
|
@@ -15,10 +15,8 @@ def known_installed_package
|
|
15
15
|
end
|
16
16
|
|
17
17
|
test_name "dsl::helpers::host_helpers #check_for_package" do
|
18
|
-
|
19
18
|
# NOTE: there does not appear to be a way to confine just to cygwin hosts
|
20
19
|
confine_block :to, :platform => /windows/ do
|
21
|
-
|
22
20
|
# NOTE: check_for_package on windows currently fails as follows:
|
23
21
|
#
|
24
22
|
# ArgumentError: wrong number of arguments (3 for 1..2)
|
@@ -43,7 +41,6 @@ test_name "dsl::helpers::host_helpers #check_for_package" do
|
|
43
41
|
end
|
44
42
|
|
45
43
|
confine_block :to, :platform => /solaris/ do
|
46
|
-
|
47
44
|
step "#check_for_package will return false if the specified package is not installed on the remote host" do
|
48
45
|
result = check_for_package default, "non-existent-package-name"
|
49
46
|
assert !result
|
@@ -70,7 +67,6 @@ test_name "dsl::helpers::host_helpers #check_for_package" do
|
|
70
67
|
end
|
71
68
|
|
72
69
|
confine_block :except, :platform => /windows|solaris|osx/ do
|
73
|
-
|
74
70
|
step "#check_for_package will return false if the specified package is not installed on the remote host" do
|
75
71
|
result = check_for_package default, "non-existent-package-name"
|
76
72
|
assert !result
|
@@ -1,23 +1,16 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #create_remote_file" do
|
4
|
-
|
5
|
-
def create_remote_file_with_backups host, remote_filename, contents, opts={}
|
4
|
+
def create_remote_file_with_backups host, remote_filename, contents, opts = {}
|
6
5
|
result = nil
|
7
6
|
repeat_fibonacci_style_for(10) do
|
8
7
|
begin
|
9
8
|
result = create_remote_file(
|
10
9
|
host, remote_filename, contents, opts
|
11
10
|
) # return of block is whether or not we're done repeating
|
12
|
-
if result.is_a?(Rsync::Result) || result.is_a?(Beaker::Result)
|
13
|
-
return result.success?
|
14
|
-
end
|
11
|
+
return result.success? if result.is_a?(Rsync::Result) || result.is_a?(Beaker::Result)
|
15
12
|
|
16
|
-
result.
|
17
|
-
next if individual_result.success?
|
18
|
-
return false
|
19
|
-
end
|
20
|
-
true
|
13
|
+
result.all? { |individual_result| individual_result.success? }
|
21
14
|
rescue Beaker::Host::CommandFailure => e
|
22
15
|
logger.info("create_remote_file threw command failure, details: ")
|
23
16
|
logger.info(" #{e}")
|
@@ -102,13 +95,15 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
102
95
|
end
|
103
96
|
end
|
104
97
|
|
105
|
-
|
106
98
|
confine_block :except, :platform => /windows/ do
|
107
99
|
# these tests exercise the rsync backend
|
108
100
|
# NOTE: rsync works fine on Windows as long as you use POSIX-style paths.
|
109
101
|
# However, these tests use Host#tmpdir which outputs mixed-style paths
|
110
102
|
# e.g. C:/cygwin64/tmp/beaker.Rp9G6L - Fix me with BKR-1503
|
111
103
|
|
104
|
+
# rsync is broken on beaker-docker
|
105
|
+
confine :except, :hypervisor => 'docker'
|
106
|
+
|
112
107
|
confine_block :except, :platform => /osx/ do
|
113
108
|
# packages are unsupported on OSX
|
114
109
|
step "installing rsync on hosts if needed" do
|
@@ -138,19 +133,18 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
138
133
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
139
134
|
contents = fixture_contents("simple_text_file")
|
140
135
|
|
141
|
-
create_remote_file_with_backups(
|
136
|
+
result = create_remote_file_with_backups(
|
142
137
|
default, remote_filename, contents, { :protocol => "rsync" }
|
143
138
|
)
|
144
139
|
|
145
140
|
fails_intermittently("https://tickets.puppetlabs.com/browse/BKR-612",
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
)
|
152
|
-
|
153
|
-
assert_equal contents, remote_contents
|
141
|
+
"default" => default,
|
142
|
+
"remote_tmpdir" => remote_tmpdir,
|
143
|
+
"remote_filename" => remote_filename,
|
144
|
+
"contents" => contents,
|
145
|
+
"result" => result) do
|
146
|
+
remote_contents = on(default, "cat #{remote_filename}").stdout
|
147
|
+
assert_equal contents, remote_contents
|
154
148
|
end
|
155
149
|
end
|
156
150
|
|
@@ -171,12 +165,11 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
171
165
|
|
172
166
|
hosts.each do |host|
|
173
167
|
fails_intermittently("https://tickets.puppetlabs.com/browse/BKR-612",
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
) do
|
168
|
+
"host" => host,
|
169
|
+
"remote_tmpdir" => remote_tmpdir,
|
170
|
+
"remote_filename" => remote_filename,
|
171
|
+
"contents" => contents,
|
172
|
+
"result" => result) do
|
180
173
|
remote_contents = on(host, "cat #{remote_filename}").stdout
|
181
174
|
assert_equal contents, remote_contents
|
182
175
|
end
|
@@ -17,7 +17,7 @@ test_name "dsl::helpers::host_helpers #curl_on" do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
step "#curl_on can retrieve the contents of a URL, using standard curl options" do
|
20
|
-
remote_tmpdir = default.tmpdir
|
20
|
+
remote_tmpdir = default.tmpdir
|
21
21
|
remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_tmpdir, "testfile.txt")
|
22
22
|
remote_targetfilename = File.join remote_tmpdir, "outfile.txt"
|
23
23
|
|
@@ -29,7 +29,7 @@ test_name "dsl::helpers::host_helpers #curl_on" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
step "#curl_on can retrieve the contents of a URL, when given a hosts array" do
|
32
|
-
remote_tmpdir = default.tmpdir
|
32
|
+
remote_tmpdir = default.tmpdir
|
33
33
|
on hosts, "mkdir -p #{remote_tmpdir}"
|
34
34
|
|
35
35
|
remote_filename = contents = nil
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #curl_with_retries" do
|
4
|
-
|
5
4
|
step "#curl_with_retries CURRENTLY fails with a RuntimeError if retries are exhausted without fetching the specified URL" do
|
6
5
|
# NOTE: would expect that this would raise Beaker::Host::CommandFailure
|
7
6
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require "helpers/test_helper"
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #on" do
|
4
|
-
|
5
4
|
step "#on raises an exception when remote command fails" do
|
6
5
|
assert_raises(Beaker::Host::CommandFailure) do
|
7
6
|
on default, "/bin/nonexistent-command"
|
@@ -9,7 +8,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
9
8
|
end
|
10
9
|
|
11
10
|
step "#on makes command output available via `.stdout` on success" do
|
12
|
-
output = on(default, %
|
11
|
+
output = on(default, %{echo "echo via on"}).stdout
|
13
12
|
assert_equal "echo via on\n", output
|
14
13
|
end
|
15
14
|
|
@@ -19,7 +18,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
19
18
|
end
|
20
19
|
|
21
20
|
step "#on makes exit status available via `.exit_code`" do
|
22
|
-
status = on(default, %
|
21
|
+
status = on(default, %{echo "echo via on"}).exit_code
|
23
22
|
assert_equal 0, status
|
24
23
|
end
|
25
24
|
|
@@ -33,7 +32,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
33
32
|
|
34
33
|
step "#on with :acceptable_exit_codes will fail for other exit codes" do
|
35
34
|
assert_raises(Beaker::Host::CommandFailure) do
|
36
|
-
on default, %
|
35
|
+
on default, %{echo "echo via on"}, :acceptable_exit_codes => [127]
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
@@ -48,7 +47,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
48
47
|
# Run a command which is (basically) guaranteed to have distinct output
|
49
48
|
# on every host, and only requires bash to be present to run on any of
|
50
49
|
# our platforms.
|
51
|
-
results = on hosts, %
|
50
|
+
results = on hosts, %{echo "${RANDOM}:${RANDOM}:${RANDOM}"}
|
52
51
|
|
53
52
|
# assert that we got results back for every host
|
54
53
|
assert_equal hosts.size, results.size
|
@@ -67,7 +66,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
67
66
|
# Run a command which is (basically) guaranteed to have distinct output
|
68
67
|
# on every host, and only requires bash to be present to run on any of
|
69
68
|
# our platforms.
|
70
|
-
results = on :agent, %
|
69
|
+
results = on :agent, %{echo "${RANDOM}:${RANDOM}:${RANDOM}"}
|
71
70
|
|
72
71
|
# assert that we got results back for every host
|
73
72
|
assert_equal hosts.size, results.size
|
@@ -86,7 +85,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
86
85
|
# Run a command which is (basically) guaranteed to have distinct output
|
87
86
|
# on every host, and only requires bash to be present to run on any of
|
88
87
|
# our platforms.
|
89
|
-
results = on "agent", %
|
88
|
+
results = on "agent", %{echo "${RANDOM}:${RANDOM}:${RANDOM}"}
|
90
89
|
|
91
90
|
# assert that we got results back for every host
|
92
91
|
assert_equal hosts.size, results.size
|
@@ -102,16 +101,19 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
102
101
|
end
|
103
102
|
|
104
103
|
step "#on allows assertions to be used in the optional block" do
|
105
|
-
on hosts, %
|
106
|
-
assert_match(/\d+:\d+/, stdout)
|
104
|
+
on hosts, %{echo "${RANDOM}:${RANDOM}"} do |result|
|
105
|
+
assert_match(/\d+:\d+/, result.stdout)
|
107
106
|
end
|
108
107
|
end
|
109
108
|
|
110
109
|
step "#on executes in parallel with :run_in_parallel => true" do
|
110
|
+
# beaker-docker can't deal with closing the connection
|
111
|
+
confine :except, :hypervisor => 'docker'
|
112
|
+
|
111
113
|
parent_pid = Process.pid
|
112
|
-
results = on(
|
114
|
+
results = on(hosts, %{echo "${RANDOM}:${RANDOM}:${RANDOM}"}, :run_in_parallel => true) do
|
113
115
|
assert(Process.pid != parent_pid)
|
114
|
-
|
116
|
+
end
|
115
117
|
|
116
118
|
# assert that we got results back for every host
|
117
119
|
assert_equal hosts.size, results.size
|
@@ -127,14 +129,17 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
127
129
|
end
|
128
130
|
|
129
131
|
step "#on in parallel exits after all processes complete if an exception is raised in one process" do
|
132
|
+
# beaker-docker can't deal with closing the connection
|
133
|
+
confine :except, :hypervisor => 'docker'
|
134
|
+
|
130
135
|
start = Time.now
|
131
136
|
|
132
137
|
tmp = nil
|
133
138
|
assert_raises NoMethodError do
|
134
|
-
on(
|
139
|
+
on(hosts, %{echo "blah"}, :run_in_parallel => true) do
|
135
140
|
sleep(1)
|
136
141
|
tmp.blah
|
137
|
-
|
142
|
+
end
|
138
143
|
end
|
139
144
|
assert(Time.now > start + 1)
|
140
145
|
end
|
@@ -4,7 +4,7 @@ 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
|
|
@@ -14,7 +14,7 @@ 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
|
|
@@ -27,7 +27,7 @@ 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|
|
@@ -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,11 +11,7 @@ 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
|
-
next if individual_result.success?
|
17
|
-
return false
|
18
|
-
end
|
19
|
-
true
|
14
|
+
result.all? { |individual_result| individual_result.success? }
|
20
15
|
rescue Beaker::Host::CommandFailure => e
|
21
16
|
logger.info("create_remote_file threw command failure, details: ")
|
22
17
|
logger.info(" #{e}")
|
@@ -29,7 +24,6 @@ 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
|
@@ -37,7 +31,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
37
31
|
step "#rsync_to CURRENTLY fails on windows systems" do
|
38
32
|
Dir.mktmpdir do |local_dir|
|
39
33
|
local_filename, _contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
40
|
-
remote_tmpdir = default.tmpdir
|
34
|
+
remote_tmpdir = default.tmpdir
|
41
35
|
|
42
36
|
assert_raises Beaker::Host::CommandFailure do
|
43
37
|
rsync_to default, local_filename, remote_tmpdir
|
@@ -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
|
@@ -119,20 +116,19 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
119
116
|
step "#rsync_to creates the file on the remote system" do
|
120
117
|
Dir.mktmpdir do |local_dir|
|
121
118
|
local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
122
|
-
remote_tmpdir = default.tmpdir
|
119
|
+
remote_tmpdir = default.tmpdir
|
123
120
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
124
121
|
|
125
122
|
result = rsync_to_with_backups default, local_filename, remote_tmpdir
|
126
123
|
|
127
124
|
fails_intermittently("https://tickets.puppetlabs.com/browse/QENG-3053",
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
) 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
|
136
132
|
remote_contents = on(default, "cat #{remote_filename}").stdout
|
137
133
|
assert_equal contents, remote_contents
|
138
134
|
end
|
@@ -142,7 +138,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
142
138
|
step "#rsync_to creates the file on all remote systems when a host array is provided" do
|
143
139
|
Dir.mktmpdir do |local_dir|
|
144
140
|
local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt")
|
145
|
-
remote_tmpdir = default.tmpdir
|
141
|
+
remote_tmpdir = default.tmpdir
|
146
142
|
on hosts, "mkdir -p #{remote_tmpdir}"
|
147
143
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
148
144
|
|
@@ -150,14 +146,13 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
150
146
|
|
151
147
|
hosts.each do |host|
|
152
148
|
fails_intermittently("https://tickets.puppetlabs.com/browse/QENG-3053",
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
) 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
|
161
156
|
remote_contents = on(host, "cat #{remote_filename}").stdout
|
162
157
|
assert_equal contents, remote_contents
|
163
158
|
end
|
@@ -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
|
|
@@ -125,7 +122,6 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
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
|
|
@@ -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"
|
@@ -41,9 +40,9 @@ test_name "dsl::helpers::host_helpers #run_script_on" do
|
|
41
40
|
Dir.mktmpdir do |local_dir|
|
42
41
|
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
43
42
|
|
44
|
-
run_script_on default, local_filename do
|
45
|
-
assert_equal 0, exit_code
|
46
|
-
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
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
@@ -40,9 +40,9 @@ test_name "dsl::helpers::host_helpers #run_script" do
|
|
40
40
|
Dir.mktmpdir do |local_dir|
|
41
41
|
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
42
42
|
|
43
|
-
run_script local_filename do
|
44
|
-
assert_equal 0, exit_code
|
45
|
-
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
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -3,7 +3,7 @@ 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
|
6
|
+
remote_tmpdir = default.tmpdir
|
7
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
|
@@ -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
|
-
on hosts, %
|
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
|
@@ -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
|