beaker 3.37.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -1
- data/acceptance/lib/helpers/test_helper.rb +0 -28
- data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +106 -103
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/install_package_test.rb +1 -50
- 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 +71 -27
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -3
- data/acceptance/tests/base/host/file_test.rb +81 -0
- data/beaker.gemspec +6 -14
- data/docs/how_to/install_puppet.md +2 -0
- data/docs/how_to/the_beaker_dsl.md +150 -150
- data/docs/how_to/upgrade_from_3_to_4.md +52 -0
- data/lib/beaker.rb +0 -10
- data/lib/beaker/dsl.rb +7 -0
- data/lib/beaker/dsl/helpers.rb +4 -6
- data/lib/beaker/dsl/helpers/host_helpers.rb +10 -34
- data/lib/beaker/dsl/install_utils.rb +0 -5
- data/lib/beaker/dsl/roles.rb +1 -1
- data/lib/beaker/host.rb +12 -11
- data/lib/beaker/host/aix/file.rb +2 -2
- data/lib/beaker/host/aix/group.rb +1 -0
- data/lib/beaker/host/aix/user.rb +1 -0
- data/lib/beaker/host/freebsd/pkg.rb +9 -0
- data/lib/beaker/host/mac/group.rb +1 -0
- data/lib/beaker/host/mac/user.rb +8 -13
- data/lib/beaker/host/pswindows/file.rb +2 -2
- data/lib/beaker/host/pswindows/group.rb +1 -0
- data/lib/beaker/host/pswindows/user.rb +1 -0
- data/lib/beaker/host/unix/exec.rb +5 -5
- data/lib/beaker/host/unix/file.rb +43 -2
- data/lib/beaker/host/unix/group.rb +1 -0
- data/lib/beaker/host/unix/user.rb +1 -0
- data/lib/beaker/host/windows/file.rb +32 -2
- data/lib/beaker/host/windows/group.rb +1 -0
- data/lib/beaker/host/windows/user.rb +1 -0
- data/lib/beaker/host_prebuilt_steps.rb +0 -4
- data/lib/beaker/hypervisor.rb +1 -5
- data/lib/beaker/result.rb +4 -0
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +14 -51
- data/spec/beaker/dsl/wrappers_spec.rb +0 -46
- data/spec/beaker/host/mac/user_spec.rb +5 -8
- data/spec/beaker/host/unix/exec_spec.rb +1 -1
- data/spec/beaker/host/unix/file_spec.rb +39 -0
- data/spec/beaker/host/windows/file_spec.rb +55 -0
- data/spec/beaker/host_prebuilt_steps_spec.rb +16 -67
- data/spec/beaker/host_spec.rb +10 -14
- data/spec/beaker/hypervisor/hypervisor_spec.rb +1 -1
- metadata +47 -165
- data/acceptance/lib/beaker/acceptance/install_utils.rb +0 -58
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_tmpdir_on_test.rb +0 -68
- data/acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb +0 -49
- data/lib/beaker/dsl/helpers/facter_helpers.rb +0 -57
- data/lib/beaker/dsl/install_utils/pe_defaults.rb +0 -143
- data/lib/beaker/dsl/install_utils/windows_utils.rb +0 -223
- data/spec/beaker/dsl/ezbake_utils_spec.rb +0 -279
- data/spec/beaker/dsl/install_utils/pe_defaults_spec.rb +0 -61
- data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +0 -263
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d46e3ea54f2a217a78497681c57a24921de8719
|
4
|
+
data.tar.gz: 175ef59e2be00d70d0238f49e8f3d49e95257e2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abc5a220b83dd595577f90140ce3b60b1daf282d77e27279f110732cc643e20d46652046be5bec9beb55aa51dec38b82928c15814a34ce78efa8460335654295
|
7
|
+
data.tar.gz: ce529642242f5408f0ea4a8bc515f00f496c977854737f21f4787a04769ef02d003d1694bd818b9ae2478af5382329e4f0019f433a09bb2983b2fb4f0acfdbe8
|
data/CHANGELOG.md
CHANGED
@@ -11,7 +11,33 @@ Tracking in this Changelog began for this project in version 3.25.0.
|
|
11
11
|
If you're looking for changes from before this, refer to the project's
|
12
12
|
git logs & PR history.
|
13
13
|
|
14
|
-
# [Unreleased](https://github.com/puppetlabs/beaker/compare/
|
14
|
+
# [Unreleased](https://github.com/puppetlabs/beaker/compare/4.0.0...master)
|
15
|
+
|
16
|
+
# [4.0.0](https://github.com/puppetlabs/beaker/compare/3.37.0...4.0.0) - 2018-08-06
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- `host.rsync_to` throws `Beaker::Host::CommandFailure` if rsync call fails (BKR-463)
|
21
|
+
- `host.rsync_to` throws `Beaker::Host::CommandFailure` if rsync does not exist on remote system (BKR-462)
|
22
|
+
- `host.rsync_to` now check through configured SSH keys to use the first valid one
|
23
|
+
- Updated some `Beaker::Host` methods to always return a `Result` object
|
24
|
+
|
25
|
+
### Added
|
26
|
+
|
27
|
+
- Adds `Beaker::Host#chown`, `#chgrp`, and `#ls_ld` methods (BKR-1499)
|
28
|
+
- `#uninstall_package` host helper, to match `#install_package`
|
29
|
+
- `Host.uninstall_package` for FreeBSD
|
30
|
+
- Now easily check a command's exit status by calling `Result.success?()` for a simple, truthy result. No need to validate the exit code manually.
|
31
|
+
|
32
|
+
### Changed
|
33
|
+
|
34
|
+
- `#set_env` no longer calls `#configure_type_defaults_on`
|
35
|
+
- `beaker-puppet` DSL Extension Library has been formally split into a standard DSL Extension Library and removed as a dependency from Beaker. Please see our [upgrade guidelines](docs/how_to/upgrade_from_3_to_4.md).
|
36
|
+
- Beaker's Hypervisor Libraries have been removed as dependencies. Please see our [upgrade guidelines](docs/how_to/upgrade_from_3_to_4.md).
|
37
|
+
|
38
|
+
### Removed
|
39
|
+
|
40
|
+
- `PEDefaults` has been moved to `beaker-pe`
|
15
41
|
|
16
42
|
# [3.37.0](https://github.com/puppetlabs/beaker/compare/3.36.0...3.37.0) - 2018-07-11
|
17
43
|
|
@@ -23,6 +49,11 @@ git logs & PR history.
|
|
23
49
|
|
24
50
|
- `Beaker::Shared::FogCredentials.get_fog_credentials()` to parse .fog credential files
|
25
51
|
|
52
|
+
### Changed
|
53
|
+
|
54
|
+
- `beaker-pe` is no longer automagically included. See [the upgrade guide](/docs/how_to/upgrade_from_3_to_4.md}) for more info
|
55
|
+
- `beaker-puppet` is no longer required as a dependency
|
56
|
+
|
26
57
|
# [3.36.0](https://github.com/puppetlabs/beaker/compare/3.35.0...3.36.0) - 2018-06-18
|
27
58
|
|
28
59
|
### Fixed
|
@@ -8,34 +8,6 @@ def test_scp_error_on_close?
|
|
8
8
|
!!ENV["BEAKER_TEST_SCP_ERROR_ON_CLOSE"]
|
9
9
|
end
|
10
10
|
|
11
|
-
# NOTE: currently there is an issue with the tmpdir_on helper on cygwin and OS X
|
12
|
-
# platforms: the `chown` command always fails with an error about not
|
13
|
-
# recognizing the Administrator:Administrator user/group. Also, the call to
|
14
|
-
# check user presence via `getent` also fails. Until this is fixed, we add this
|
15
|
-
# shim that delegates to a non-`chown`/non-`getent`-executing version for the
|
16
|
-
# purposes of our test setup.
|
17
|
-
#
|
18
|
-
# TODO: fix via: https://tickets.puppetlabs.com/browse/BKR-496
|
19
|
-
def tmpdir_on(hosts, path_prefix = '', user=nil)
|
20
|
-
first_host = Array(hosts).first
|
21
|
-
|
22
|
-
return create_tmpdir_on(hosts, path_prefix, user) unless \
|
23
|
-
first_host.is_cygwin? or first_host.platform =~ /osx/
|
24
|
-
|
25
|
-
block_on hosts do | host |
|
26
|
-
# use default user logged into this host
|
27
|
-
if not user
|
28
|
-
user = host['user']
|
29
|
-
end
|
30
|
-
|
31
|
-
if defined? host.tmpdir
|
32
|
-
host.tmpdir(path_prefix)
|
33
|
-
else
|
34
|
-
raise "Host platform not supported by `tmpdir_on`."
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
11
|
# Returns the absolute path where file fixtures are located.
|
40
12
|
def fixture_path
|
41
13
|
@fixture_path ||=
|
@@ -17,6 +17,6 @@ test_name 'Install beaker and checkout branch if necessary' do
|
|
17
17
|
step 'Build the gem and install it on the local system' do
|
18
18
|
build_output = on(default, 'cd /opt/beaker/;gem build beaker.gemspec').stdout
|
19
19
|
version = build_output.match(/^ File: (.+)$/)[1]
|
20
|
-
on(default, "cd /opt/beaker/;gem install #{version} --no-rdoc --no-ri")
|
20
|
+
on(default, "cd /opt/beaker/;gem install #{version} --no-rdoc --no-ri; gem install beaker-vmpooler")
|
21
21
|
end
|
22
22
|
end
|
@@ -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 =
|
7
|
-
remote_destination =
|
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 =
|
13
|
+
remote_source = default.tmpdir()
|
14
14
|
remote_source_filename = File.join(remote_source, "puppet.conf")
|
15
15
|
remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_source, "puppet.conf")
|
16
16
|
|
@@ -20,11 +20,11 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
step "#backup_the_file copies `puppet.conf` from the source to the destination directory" do
|
23
|
-
remote_source =
|
23
|
+
remote_source = default.tmpdir()
|
24
24
|
remote_source_filename = File.join(remote_source, "puppet.conf")
|
25
25
|
remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_source, "puppet.conf")
|
26
26
|
|
27
|
-
remote_destination =
|
27
|
+
remote_destination = default.tmpdir()
|
28
28
|
remote_destination_filename = File.join(remote_destination, "puppet.conf.bak")
|
29
29
|
|
30
30
|
result = backup_the_file default, remote_source, remote_destination
|
@@ -35,11 +35,11 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
step "#backup_the_file copies a named file from the source to the destination directory" do
|
38
|
-
remote_source =
|
38
|
+
remote_source = default.tmpdir()
|
39
39
|
remote_source_filename = File.join(remote_source, "testfile.txt")
|
40
40
|
remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_source, "testfile.txt")
|
41
41
|
|
42
|
-
remote_destination =
|
42
|
+
remote_destination = default.tmpdir()
|
43
43
|
remote_destination_filename = File.join(remote_destination, "testfile.txt.bak")
|
44
44
|
|
45
45
|
result = backup_the_file default, remote_source, remote_destination, "testfile.txt"
|
@@ -50,10 +50,10 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
step "#backup_the_file CURRENTLY will fail if given a hosts array" do
|
53
|
-
remote_source =
|
53
|
+
remote_source = default.tmpdir()
|
54
54
|
remote_source_filename = File.join(remote_source, "testfile.txt")
|
55
55
|
remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_source, "testfile.txt")
|
56
|
-
remote_destination =
|
56
|
+
remote_destination = default.tmpdir()
|
57
57
|
|
58
58
|
remote_destination_filename = File.join(remote_destination, "testfile.txt.bak")
|
59
59
|
|
@@ -2,14 +2,6 @@ require "helpers/test_helper"
|
|
2
2
|
|
3
3
|
test_name "dsl::helpers::host_helpers #create_remote_file" do
|
4
4
|
|
5
|
-
confine_block :to, :platform => /^centos|el-\d|fedora/ do
|
6
|
-
step "installing `rsync` on #{default['platform']} for all later test steps" do
|
7
|
-
hosts.each do |host|
|
8
|
-
install_package host, "rsync"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
5
|
if test_scp_error_on_close?
|
14
6
|
step "#create_remote_file fails when the remote path does not exist" do
|
15
7
|
assert_raises Beaker::Host::CommandFailure do
|
@@ -24,18 +16,8 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
24
16
|
end
|
25
17
|
end
|
26
18
|
|
27
|
-
step "#create_remote_file CURRENTLY does not fail and does not create a remote file when the remote path does not exist, using rsync" do
|
28
|
-
# NOTE: would expect this to fail with Beaker::Host::CommandFailure
|
29
|
-
|
30
|
-
create_remote_file default, "/non/existent/testfile.txt", "contents\n", { :protocol => 'rsync' }
|
31
|
-
|
32
|
-
assert_raises Beaker::Host::CommandFailure do
|
33
|
-
on(default, "cat /non/existent/testfile.txt").exit_code
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
19
|
step "#create_remote_file creates a remote file with the specified contents" do
|
38
|
-
remote_tmpdir =
|
20
|
+
remote_tmpdir = default.tmpdir("beaker")
|
39
21
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
40
22
|
contents = fixture_contents("simple_text_file")
|
41
23
|
|
@@ -46,7 +28,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
46
28
|
end
|
47
29
|
|
48
30
|
step "#create_remote_file creates a remote file with the specified contents, using scp" do
|
49
|
-
remote_tmpdir =
|
31
|
+
remote_tmpdir = default.tmpdir("beaker")
|
50
32
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
51
33
|
contents = fixture_contents("simple_text_file")
|
52
34
|
|
@@ -56,62 +38,15 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
56
38
|
assert_equal contents, remote_contents
|
57
39
|
end
|
58
40
|
|
59
|
-
#
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
remote_tmpdir = tmpdir_on default
|
66
|
-
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
67
|
-
contents = fixture_contents("simple_text_file")
|
68
|
-
|
69
|
-
create_remote_file default, remote_filename, contents, { :protocol => "rsync" }
|
70
|
-
|
71
|
-
assert_raises Beaker::Host::CommandFailure do
|
72
|
-
remote_contents = on(default, "cat #{remote_filename}").stdout
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
confine_block :except, :platform => /windows/ do
|
78
|
-
|
79
|
-
step "#create_remote_file creates a remote file with the specified contents, using rsync" do
|
80
|
-
remote_tmpdir = tmpdir_on default
|
81
|
-
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
82
|
-
contents = fixture_contents("simple_text_file")
|
83
|
-
|
84
|
-
result = create_remote_file default, remote_filename, contents, { :protocol => "rsync" }
|
85
|
-
|
86
|
-
fails_intermittently("https://tickets.puppetlabs.com/browse/BKR-612",
|
87
|
-
"default" => default,
|
88
|
-
"remote_tmpdir" => remote_tmpdir,
|
89
|
-
"remote_filename" => remote_filename,
|
90
|
-
"contents" => contents,
|
91
|
-
"result" => result
|
92
|
-
) do
|
93
|
-
remote_contents = on(default, "cat #{remote_filename}").stdout
|
94
|
-
assert_equal contents, remote_contents
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
step "#create_remote_file' does not create a remote file when an unknown protocol is specified" do
|
100
|
-
remote_tmpdir = tmpdir_on default
|
101
|
-
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
102
|
-
contents = fixture_contents("simple_text_file")
|
103
|
-
|
104
|
-
create_remote_file default, remote_filename, contents, { :protocol => 'unknown' }
|
105
|
-
|
106
|
-
assert_raises Beaker::Host::CommandFailure do
|
107
|
-
on(default, "cat #{remote_filename}").exit_code
|
41
|
+
step "#create_remote_file creates remote files on all remote hosts, when given an array" do
|
42
|
+
remote_dir = "/tmp/beaker_remote_file_test"
|
43
|
+
# ensure remote dir exists on all hosts
|
44
|
+
hosts.each do |host|
|
45
|
+
# we can't use tmpdir here, because some hosts may have different tmpdir behavior.
|
46
|
+
host.mkdir_p(remote_dir)
|
108
47
|
end
|
109
|
-
end
|
110
48
|
|
111
|
-
|
112
|
-
remote_tmpdir = tmpdir_on default
|
113
|
-
on hosts, "mkdir -p #{remote_tmpdir}"
|
114
|
-
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
49
|
+
remote_filename = File.join(remote_dir, "testfile.txt")
|
115
50
|
contents = fixture_contents("simple_text_file")
|
116
51
|
|
117
52
|
create_remote_file hosts, remote_filename, contents
|
@@ -123,9 +58,14 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
123
58
|
end
|
124
59
|
|
125
60
|
step "#create_remote_file creates remote files on all remote hosts, when given an array, using scp" do
|
126
|
-
|
127
|
-
|
128
|
-
|
61
|
+
remote_dir = "/tmp/beaker_remote_file_test"
|
62
|
+
# ensure remote dir exists on all hosts
|
63
|
+
hosts.each do |host|
|
64
|
+
# we can't use tmpdir here, because some hosts may have different tmpdir behavior.
|
65
|
+
host.mkdir_p(remote_dir)
|
66
|
+
end
|
67
|
+
|
68
|
+
remote_filename = File.join(remote_dir, "testfile.txt")
|
129
69
|
contents = fixture_contents("simple_text_file")
|
130
70
|
|
131
71
|
create_remote_file hosts, remote_filename, contents, { :protocol => 'scp' }
|
@@ -136,35 +76,63 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
136
76
|
end
|
137
77
|
end
|
138
78
|
|
139
|
-
# NOTE: there does not appear to be a way to confine just to cygwin hosts
|
140
|
-
confine_block :to, :platform => /windows/ do
|
141
79
|
|
142
|
-
|
143
|
-
#
|
80
|
+
confine_block :except, :platform => /windows/ do
|
81
|
+
# these tests exercise the rsync backend
|
82
|
+
# NOTE: rsync works fine on Windows as long as you use POSIX-style paths.
|
83
|
+
# However, these tests use Host#tmpdir which outputs mixed-style paths
|
84
|
+
# e.g. C:/cygwin64/tmp/beaker.Rp9G6L - Fix me with BKR-1503
|
85
|
+
|
86
|
+
confine_block :except, :platform => /osx/ do
|
87
|
+
# packages are unsupported on OSX
|
88
|
+
step "installing rsync on hosts if needed" do
|
89
|
+
hosts.each do |host|
|
90
|
+
if host.check_for_package('rsync')
|
91
|
+
host[:rsync_installed] = true
|
92
|
+
else
|
93
|
+
host[:rsync_installed] = false
|
94
|
+
host.install_package "rsync"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
144
99
|
|
145
|
-
step "#create_remote_file
|
146
|
-
|
147
|
-
|
100
|
+
step "#create_remote_file fails and does not create a remote file when the remote path does not exist, using rsync" do
|
101
|
+
assert_raises Beaker::Host::CommandFailure do
|
102
|
+
create_remote_file default, "/non/existent/testfile.txt", "contents\n", { :protocol => 'rsync' }
|
103
|
+
end
|
104
|
+
|
105
|
+
assert_raises Beaker::Host::CommandFailure do
|
106
|
+
on(default, "cat /non/existent/testfile.txt").exit_code
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
step "#create_remote_file creates a remote file with the specified contents, using rsync" do
|
111
|
+
remote_tmpdir = default.tmpdir("beaker")
|
148
112
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
149
113
|
contents = fixture_contents("simple_text_file")
|
150
114
|
|
151
|
-
create_remote_file
|
115
|
+
result = create_remote_file default, remote_filename, contents, { :protocol => "rsync" }
|
152
116
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
117
|
+
fails_intermittently("https://tickets.puppetlabs.com/browse/BKR-612",
|
118
|
+
"default" => default,
|
119
|
+
"remote_tmpdir" => remote_tmpdir,
|
120
|
+
"remote_filename" => remote_filename,
|
121
|
+
"contents" => contents,
|
122
|
+
"result" => result
|
123
|
+
) do
|
124
|
+
remote_contents = on(default, "cat #{remote_filename}").stdout
|
125
|
+
assert_equal contents, remote_contents
|
157
126
|
end
|
158
127
|
end
|
159
|
-
end
|
160
|
-
|
161
|
-
confine_block :except, :platform => /windows|fedora/ do
|
162
128
|
|
163
129
|
step "#create_remote_file creates remote files on all remote hosts, when given an array, using rsync" do
|
164
|
-
remote_tmpdir =
|
165
|
-
|
166
|
-
|
167
|
-
|
130
|
+
remote_tmpdir = "/tmp/beaker_remote_file_test"
|
131
|
+
# ensure remote dir exists on all hosts
|
132
|
+
hosts.each do |host|
|
133
|
+
# we can't use tmpdir here, because some hosts may have different tmpdir behavior.
|
134
|
+
host.mkdir_p(remote_tmpdir)
|
135
|
+
end
|
168
136
|
|
169
137
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
170
138
|
contents = fixture_contents("simple_text_file")
|
@@ -184,17 +152,52 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
184
152
|
end
|
185
153
|
end
|
186
154
|
end
|
155
|
+
|
156
|
+
confine_block :except, :platform => /osx/ do
|
157
|
+
# packages are unsupported on OSX
|
158
|
+
step "uninstalling rsync on hosts if needed" do
|
159
|
+
hosts.each do |host|
|
160
|
+
if !host[:rsync_installed]
|
161
|
+
# rsync wasn't installed on #{host} when we started, so we should clean up after ourselves
|
162
|
+
rsync_package = "rsync"
|
163
|
+
# solaris-10 uses OpenCSW pkgutil, which prepends "CSW" to its provided packages
|
164
|
+
# TODO: fix this with BKR-1502
|
165
|
+
rsync_package = "CSWrsync" if host['platform'] =~ /solaris-10/
|
166
|
+
host.uninstall_package rsync_package
|
167
|
+
end
|
168
|
+
host.delete(:rsync_installed)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
187
172
|
end
|
188
173
|
|
189
|
-
|
174
|
+
step "#create_remote_file' does not create a remote file when an unknown protocol is specified" do
|
175
|
+
remote_tmpdir = default.tmpdir("beaker")
|
176
|
+
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
177
|
+
contents = fixture_contents("simple_text_file")
|
190
178
|
|
191
|
-
|
192
|
-
# NOTE: this is basically a #teardown section for test isolation
|
193
|
-
# Could we reorganize tests into different files to make this
|
194
|
-
# clearer?
|
179
|
+
create_remote_file default, remote_filename, contents, { :protocol => 'unknown' }
|
195
180
|
|
196
|
-
|
197
|
-
|
181
|
+
assert_raises Beaker::Host::CommandFailure do
|
182
|
+
on(default, "cat #{remote_filename}").exit_code
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# NOTE: there does not appear to be a way to confine just to cygwin hosts
|
187
|
+
confine_block :to, :platform => /windows/ do
|
188
|
+
# NOTE: rsync works fine on Windows as long as you use POSIX-style paths.
|
189
|
+
# Fix me with BKR-1503
|
190
|
+
step "#create_remote_file CURRENTLY fails on #{default['platform']}, using rsync" do
|
191
|
+
remote_tmpdir = default.tmpdir("beaker")
|
192
|
+
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
193
|
+
contents = fixture_contents("simple_text_file")
|
194
|
+
|
195
|
+
assert_raises Beaker::Host::CommandFailure do
|
196
|
+
create_remote_file default, remote_filename, contents, { :protocol => "rsync" }
|
197
|
+
end
|
198
|
+
|
199
|
+
assert_raises Beaker::Host::CommandFailure do
|
200
|
+
remote_contents = on(default, "cat #{remote_filename}").stdout
|
198
201
|
end
|
199
202
|
end
|
200
203
|
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 =
|
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 =
|
32
|
+
remote_tmpdir = default.tmpdir()
|
33
33
|
on hosts, "mkdir -p #{remote_tmpdir}"
|
34
34
|
|
35
35
|
remote_filename = contents = nil
|