beaker 5.2.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +1 -1
- data/.rubocop.yml +1 -2
- data/.rubocop_todo.yml +54 -2
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -0
- data/acceptance/tests/base/dsl/helpers/configuration_test.rb +1 -0
- data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +5 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +5 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +3 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +6 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +6 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/echo_on_test.rb +3 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +10 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +1 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +2 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +13 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +2 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +2 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +2 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +2 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +5 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +2 -0
- data/acceptance/tests/base/host/file_test.rb +7 -0
- data/acceptance/tests/base/host/host_test.rb +27 -4
- data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +3 -3
- data/acceptance/tests/hypervisor/communication_test.rb +1 -1
- data/beaker.gemspec +7 -4
- data/lib/beaker/version.rb +1 -1
- metadata +47 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4829c1a428f59340c095f78aa87331fb6a7df76854cdb4d95ed62553af19112
|
4
|
+
data.tar.gz: 0e08786ce7520319ea25c94ece1fb8f3a2a56e507035fd4ced4edeabfa1153ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ecddce8f3ffcc7fba3dceb5061667d48332808a76d88aae73b7d681e1d1f4478d99bdd464aa9ea3a6568425630a105618eb643ee6b9d9710e4e90adabb8e529
|
7
|
+
data.tar.gz: dd41043f67f6d951beb5de7739e7e9363a221ff2a09d9448edca2bdb9e054ad19200e639da3714d1c364e2fcc5c7ee6b1d17f572b5bdd7c458373301c23acf3a
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config
|
3
|
-
# using RuboCop version 1.50.
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2023-05-30 09:17:22 UTC using RuboCop version 1.50.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 15
|
9
10
|
# Configuration parameters: AllowedMethods.
|
10
11
|
# AllowedMethods: enums
|
11
12
|
Lint/ConstantDefinitionInBlock:
|
@@ -26,6 +27,7 @@ Lint/ConstantDefinitionInBlock:
|
|
26
27
|
- 'spec/beaker/host/windows/pkg_spec.rb'
|
27
28
|
- 'spec/beaker/options/hosts_file_parser_spec.rb'
|
28
29
|
|
30
|
+
# Offense count: 17
|
29
31
|
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
30
32
|
Lint/EmptyBlock:
|
31
33
|
Exclude:
|
@@ -35,16 +37,19 @@ Lint/EmptyBlock:
|
|
35
37
|
- 'spec/beaker/logger_junit_spec.rb'
|
36
38
|
- 'spec/beaker/logger_spec.rb'
|
37
39
|
|
40
|
+
# Offense count: 1
|
38
41
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
39
42
|
Lint/NonAtomicFileOperation:
|
40
43
|
Exclude:
|
41
44
|
- 'acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb'
|
42
45
|
|
46
|
+
# Offense count: 2
|
43
47
|
Lint/RescueException:
|
44
48
|
Exclude:
|
45
49
|
- 'lib/beaker/dsl/structure.rb'
|
46
50
|
- 'lib/beaker/test_suite_result.rb'
|
47
51
|
|
52
|
+
# Offense count: 27
|
48
53
|
Lint/ShadowingOuterLocalVariable:
|
49
54
|
Exclude:
|
50
55
|
- 'lib/beaker/dsl/helpers/host_helpers.rb'
|
@@ -55,6 +60,7 @@ Lint/ShadowingOuterLocalVariable:
|
|
55
60
|
- 'lib/beaker/host_prebuilt_steps.rb'
|
56
61
|
- 'lib/beaker/perf.rb'
|
57
62
|
|
63
|
+
# Offense count: 12
|
58
64
|
Lint/UselessAssignment:
|
59
65
|
Exclude:
|
60
66
|
- 'acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb'
|
@@ -62,6 +68,29 @@ Lint/UselessAssignment:
|
|
62
68
|
- 'lib/beaker/dsl/helpers/host_helpers.rb'
|
63
69
|
- 'lib/beaker/logger_junit.rb'
|
64
70
|
|
71
|
+
# Offense count: 5
|
72
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
73
|
+
Minitest/AssertTruthy:
|
74
|
+
Exclude:
|
75
|
+
- 'acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb'
|
76
|
+
- 'acceptance/tests/base/host/host_test.rb'
|
77
|
+
- 'acceptance/tests/hypervisor/communication_test.rb'
|
78
|
+
|
79
|
+
# Offense count: 2
|
80
|
+
# Configuration parameters: Severity.
|
81
|
+
Minitest/AssertWithExpectedArgument:
|
82
|
+
Exclude:
|
83
|
+
- 'acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb'
|
84
|
+
|
85
|
+
# Offense count: 9
|
86
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
87
|
+
Minitest/RefuteFalse:
|
88
|
+
Exclude:
|
89
|
+
- 'acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb'
|
90
|
+
- 'acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb'
|
91
|
+
- 'acceptance/tests/base/host/host_test.rb'
|
92
|
+
|
93
|
+
# Offense count: 20
|
65
94
|
# Configuration parameters: ForbiddenDelimiters.
|
66
95
|
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
67
96
|
Naming/HeredocDelimiterNaming:
|
@@ -77,6 +106,7 @@ Naming/HeredocDelimiterNaming:
|
|
77
106
|
- 'spec/beaker/host/windows_spec.rb'
|
78
107
|
- 'spec/beaker/test_case_spec.rb'
|
79
108
|
|
109
|
+
# Offense count: 2
|
80
110
|
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
81
111
|
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
82
112
|
Naming/MemoizedInstanceVariableName:
|
@@ -84,6 +114,7 @@ Naming/MemoizedInstanceVariableName:
|
|
84
114
|
- 'lib/beaker/host.rb'
|
85
115
|
- 'lib/beaker/options/presets.rb'
|
86
116
|
|
117
|
+
# Offense count: 4
|
87
118
|
# Configuration parameters: MinSize.
|
88
119
|
Performance/CollectionLiteralInLoop:
|
89
120
|
Exclude:
|
@@ -91,11 +122,13 @@ Performance/CollectionLiteralInLoop:
|
|
91
122
|
- 'lib/beaker/dsl/structure.rb'
|
92
123
|
- 'lib/beaker/test_suite_result.rb'
|
93
124
|
|
125
|
+
# Offense count: 17
|
94
126
|
RSpec/AnyInstance:
|
95
127
|
Exclude:
|
96
128
|
- 'spec/beaker/host/windows/file_spec.rb'
|
97
129
|
- 'spec/beaker/subcommand_spec.rb'
|
98
130
|
|
131
|
+
# Offense count: 12
|
99
132
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
100
133
|
RSpec/BeEq:
|
101
134
|
Exclude:
|
@@ -104,15 +137,18 @@ RSpec/BeEq:
|
|
104
137
|
- 'spec/beaker/host/windows/exec_spec.rb'
|
105
138
|
- 'spec/beaker/host_spec.rb'
|
106
139
|
|
140
|
+
# Offense count: 121
|
107
141
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
108
142
|
# Prefixes: when, with, without
|
109
143
|
RSpec/ContextWording:
|
110
144
|
Enabled: false
|
111
145
|
|
146
|
+
# Offense count: 239
|
112
147
|
# Configuration parameters: CountAsOne.
|
113
148
|
RSpec/ExampleLength:
|
114
149
|
Max: 44
|
115
150
|
|
151
|
+
# Offense count: 27
|
116
152
|
RSpec/ExpectInHook:
|
117
153
|
Exclude:
|
118
154
|
- 'spec/beaker/cli_spec.rb'
|
@@ -124,6 +160,7 @@ RSpec/ExpectInHook:
|
|
124
160
|
- 'spec/beaker/options/parser_spec.rb'
|
125
161
|
- 'spec/beaker/ssh_connection_spec.rb'
|
126
162
|
|
163
|
+
# Offense count: 22
|
127
164
|
# Configuration parameters: AssignmentOnly.
|
128
165
|
RSpec/InstanceVariable:
|
129
166
|
Exclude:
|
@@ -133,10 +170,12 @@ RSpec/InstanceVariable:
|
|
133
170
|
- 'spec/beaker/dsl/test_tagging_spec.rb'
|
134
171
|
- 'spec/beaker/host_prebuilt_steps_spec.rb'
|
135
172
|
|
173
|
+
# Offense count: 3
|
136
174
|
RSpec/IteratedExpectation:
|
137
175
|
Exclude:
|
138
176
|
- 'spec/beaker/dsl/helpers/host_helpers_spec.rb'
|
139
177
|
|
178
|
+
# Offense count: 12
|
140
179
|
RSpec/LeakyConstantDeclaration:
|
141
180
|
Exclude:
|
142
181
|
- 'spec/beaker/host/freebsd/exec_spec.rb'
|
@@ -152,19 +191,23 @@ RSpec/LeakyConstantDeclaration:
|
|
152
191
|
- 'spec/beaker/host/windows/pkg_spec.rb'
|
153
192
|
- 'spec/beaker/options/hosts_file_parser_spec.rb'
|
154
193
|
|
194
|
+
# Offense count: 1
|
155
195
|
RSpec/MultipleDescribes:
|
156
196
|
Exclude:
|
157
197
|
- 'spec/beaker/dsl/test_tagging_spec.rb'
|
158
198
|
|
199
|
+
# Offense count: 134
|
159
200
|
# Configuration parameters: AllowSubject.
|
160
201
|
RSpec/MultipleMemoizedHelpers:
|
161
202
|
Max: 17
|
162
203
|
|
204
|
+
# Offense count: 500
|
163
205
|
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
164
206
|
# SupportedStyles: always, named_only
|
165
207
|
RSpec/NamedSubject:
|
166
208
|
Enabled: false
|
167
209
|
|
210
|
+
# Offense count: 42
|
168
211
|
# Configuration parameters: AllowedPatterns.
|
169
212
|
# AllowedPatterns: ^expect_, ^assert_
|
170
213
|
RSpec/NoExpectationExample:
|
@@ -175,17 +218,20 @@ RSpec/NoExpectationExample:
|
|
175
218
|
- 'spec/beaker/logger_spec.rb'
|
176
219
|
- 'spec/beaker/options/subcommand_options_parser_spec.rb'
|
177
220
|
|
221
|
+
# Offense count: 7
|
178
222
|
RSpec/RepeatedDescription:
|
179
223
|
Exclude:
|
180
224
|
- 'spec/beaker/cli_spec.rb'
|
181
225
|
- 'spec/beaker/host/unix/exec_spec.rb'
|
182
226
|
- 'spec/beaker/host/unix/pkg_spec.rb'
|
183
227
|
|
228
|
+
# Offense count: 4
|
184
229
|
RSpec/RepeatedExample:
|
185
230
|
Exclude:
|
186
231
|
- 'spec/beaker/dsl/roles_spec.rb'
|
187
232
|
- 'spec/beaker/logger_spec.rb'
|
188
233
|
|
234
|
+
# Offense count: 178
|
189
235
|
RSpec/SubjectStub:
|
190
236
|
Exclude:
|
191
237
|
- 'spec/beaker/dsl/assertions_spec.rb'
|
@@ -202,6 +248,7 @@ RSpec/SubjectStub:
|
|
202
248
|
- 'spec/beaker/host/windows/user_spec.rb'
|
203
249
|
- 'spec/beaker/host_prebuilt_steps_spec.rb'
|
204
250
|
|
251
|
+
# Offense count: 12
|
205
252
|
RSpec/UnspecifiedException:
|
206
253
|
Exclude:
|
207
254
|
- 'spec/beaker/cli_spec.rb'
|
@@ -209,15 +256,18 @@ RSpec/UnspecifiedException:
|
|
209
256
|
- 'spec/beaker/host_spec.rb'
|
210
257
|
- 'spec/beaker/test_suite_spec.rb'
|
211
258
|
|
259
|
+
# Offense count: 86
|
212
260
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
213
261
|
RSpec/VerifiedDoubles:
|
214
262
|
Enabled: false
|
215
263
|
|
264
|
+
# Offense count: 2
|
216
265
|
# This cop supports safe autocorrection (--autocorrect).
|
217
266
|
Rake/Desc:
|
218
267
|
Exclude:
|
219
268
|
- 'Rakefile'
|
220
269
|
|
270
|
+
# Offense count: 7
|
221
271
|
Security/Eval:
|
222
272
|
Exclude:
|
223
273
|
- 'Rakefile'
|
@@ -228,10 +278,12 @@ Security/Eval:
|
|
228
278
|
- 'lib/beaker/options/options_file_parser.rb'
|
229
279
|
- 'lib/beaker/test_case.rb'
|
230
280
|
|
281
|
+
# Offense count: 1
|
231
282
|
Security/Open:
|
232
283
|
Exclude:
|
233
284
|
- 'lib/beaker/dsl/helpers/web_helpers.rb'
|
234
285
|
|
286
|
+
# Offense count: 104
|
235
287
|
# This cop supports safe autocorrection (--autocorrect).
|
236
288
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
237
289
|
# URISchemes: http, https
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [5.3.0] (https://github.com/voxpupuli/beaker/tree/5.3.0) (2023-06-06)
|
4
|
+
|
5
|
+
**Implemented enhancements:**
|
6
|
+
|
7
|
+
- Add bcrypt_pbkdf to fix ed25519 ssh keys support [\#1810](https://github.com/voxpupuli/beaker/pull/1810) ([jay7x](https://github.com/jay7x))
|
8
|
+
|
9
|
+
**Merged changes:**
|
10
|
+
|
11
|
+
- Build gems with verbosity and strictness [\#1811](https://github.com/voxpupuli/beaker/pull/1811) ([bastelfreak](https://github.com/bastelfreak))
|
12
|
+
- rubocop: autofix [\#1816](https://github.com/voxpupuli/beaker/pull/1816) ([bastelfreak](https://github.com/bastelfreak))
|
13
|
+
- GCG: Add missing faraday dependency [\#1815](https://github.com/voxpupuli/beaker/pull/1815) ([bastelfreak](https://github.com/bastelfreak))
|
14
|
+
|
3
15
|
## [5.2.0](https://github.com/voxpupuli/beaker/tree/5.2.0) (2023-04-28)
|
4
16
|
|
5
17
|
**Implemented enhancements:**
|
data/Gemfile
CHANGED
@@ -8,6 +8,7 @@ test_name "dsl::helpers::host_helpers test configuration validation" do
|
|
8
8
|
"dsl::helpers::host_helpers acceptance tests require at least two hosts"
|
9
9
|
|
10
10
|
agents = select_hosts(:roles => "agent")
|
11
|
+
|
11
12
|
assert (agents.size > 1),
|
12
13
|
"dsl::helpers::host_helpers acceptance tests require at least two hosts with the :agent role"
|
13
14
|
|
@@ -15,6 +15,7 @@ test_name 'Hocon Helpers Test' do
|
|
15
15
|
|
16
16
|
step '#hocon_file_read : reads doc' do
|
17
17
|
doc = hocon_file_read_on(hosts[0], hocon_filename)
|
18
|
+
|
18
19
|
assert(doc.has_value?('setting2'))
|
19
20
|
end
|
20
21
|
|
@@ -34,7 +35,7 @@ test_name 'Hocon Helpers Test' do
|
|
34
35
|
end
|
35
36
|
fail('execution should not continue in failure mode')
|
36
37
|
rescue ArgumentError => e
|
37
|
-
|
38
|
+
assert_includes(e.to_s, 'requires a filename')
|
38
39
|
else
|
39
40
|
fail('No exception raised in failure mode')
|
40
41
|
end
|
@@ -53,7 +54,7 @@ test_name 'Hocon Helpers Test' do
|
|
53
54
|
hocon_file_edit_on(hosts, hocon_filename)
|
54
55
|
fail('execution should not continue in failure mode')
|
55
56
|
rescue ArgumentError => e
|
56
|
-
|
57
|
+
assert_includes(e.to_s, 'No block was provided')
|
57
58
|
else
|
58
59
|
fail('No exception raised in failure mode')
|
59
60
|
end
|
@@ -71,6 +72,7 @@ test_name 'Hocon Helpers Test' do
|
|
71
72
|
step '#hocon_file_edit_on : independently read value to verify save' do
|
72
73
|
hocon_file_edit_on(hosts, hocon_filename) do |_host, doc|
|
73
74
|
msg_fail = 'Should have saved "a.b" value inserted in previous step'
|
75
|
+
|
74
76
|
assert(doc.has_value?('a.b'), msg_fail)
|
75
77
|
end
|
76
78
|
end
|
@@ -86,6 +88,7 @@ test_name 'Hocon Helpers Test' do
|
|
86
88
|
step '#hocon_file_edit_in_place_on : verify save' do
|
87
89
|
hocon_file_edit_on(hosts, hocon_filename) do |_host, doc|
|
88
90
|
msg_fail = 'Should have saved "c.d" value inserted in previous step'
|
91
|
+
|
89
92
|
assert(doc.has_value?('c.d'), msg_fail)
|
90
93
|
end
|
91
94
|
end
|
@@ -15,6 +15,7 @@ test_name "dsl::helpers::host_helpers #archive_file_from" do
|
|
15
15
|
assert_equal(false, Dir.exist?('archive'))
|
16
16
|
assert_equal(false, Dir.exist?('archive/sut-files'))
|
17
17
|
archive_file_from(default, filepath)
|
18
|
+
|
18
19
|
assert_equal(true, Dir.exist?('archive/sut-files'))
|
19
20
|
end
|
20
21
|
|
@@ -32,17 +33,20 @@ test_name "dsl::helpers::host_helpers #archive_file_from" do
|
|
32
33
|
# Create a remote file to archive
|
33
34
|
filepath = default.tmpfile('archive-file-test')
|
34
35
|
create_remote_file(default, filepath, 'number of the beast')
|
36
|
+
|
35
37
|
assert_equal(false, Dir.exist?(filepath))
|
36
38
|
|
37
39
|
# Test that the file is copied locally to <archiveroot>/<hostname>/<filepath>
|
38
40
|
Dir.mktmpdir do |tmpdir|
|
39
41
|
tar_path = File.join(tmpdir, default, filepath + '.tgz')
|
40
42
|
archive_file_from(default, filepath, {}, tmpdir, tar_path)
|
41
|
-
|
43
|
+
|
44
|
+
assert_path_exists(tar_path)
|
42
45
|
expected_path = File.join(tmpdir, default)
|
43
46
|
|
44
47
|
tgz = Zlib::GzipReader.new(File.open(tar_path, 'rb'))
|
45
48
|
Minitar.unpack(tgz, expected_path)
|
49
|
+
|
46
50
|
assert_equal('number of the beast', File.read(expected_path + '/' + filepath).strip)
|
47
51
|
end
|
48
52
|
end
|
@@ -6,6 +6,7 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
6
6
|
remote_source = default.tmpdir
|
7
7
|
remote_destination = default.tmpdir
|
8
8
|
result = backup_the_file default, remote_source, remote_destination
|
9
|
+
|
9
10
|
assert_nil result
|
10
11
|
end
|
11
12
|
|
@@ -29,6 +30,7 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
29
30
|
|
30
31
|
assert_equal remote_destination_filename, result
|
31
32
|
remote_contents = on(default, "cat #{remote_destination_filename}").stdout
|
33
|
+
|
32
34
|
assert_equal contents, remote_contents
|
33
35
|
end
|
34
36
|
|
@@ -43,6 +45,7 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do
|
|
43
45
|
|
44
46
|
assert_equal remote_destination_filename, result
|
45
47
|
remote_contents = on(default, "cat #{remote_destination_filename}").stdout
|
48
|
+
|
46
49
|
assert_equal contents, remote_contents
|
47
50
|
end
|
48
51
|
|
@@ -25,11 +25,13 @@ test_name "dsl::helpers::host_helpers #check_for_package" do
|
|
25
25
|
|
26
26
|
step "#check_for_package will return false if the specified package is not installed on the remote host" do
|
27
27
|
result = check_for_package default, "non-existent-package-name"
|
28
|
+
|
28
29
|
assert !result
|
29
30
|
end
|
30
31
|
|
31
32
|
step "#check_for_package will return true if the specified package is installed on the remote host" do
|
32
33
|
result = check_for_package default, known_installed_package
|
34
|
+
|
33
35
|
assert result
|
34
36
|
end
|
35
37
|
|
@@ -43,11 +45,13 @@ test_name "dsl::helpers::host_helpers #check_for_package" do
|
|
43
45
|
confine_block :to, :platform => /solaris/ do
|
44
46
|
step "#check_for_package will return false if the specified package is not installed on the remote host" do
|
45
47
|
result = check_for_package default, "non-existent-package-name"
|
48
|
+
|
46
49
|
assert !result
|
47
50
|
end
|
48
51
|
|
49
52
|
step "#check_for_package will return true if the specified package is installed on the remote host" do
|
50
53
|
result = check_for_package default, known_installed_package
|
54
|
+
|
51
55
|
assert result
|
52
56
|
end
|
53
57
|
|
@@ -69,12 +73,14 @@ test_name "dsl::helpers::host_helpers #check_for_package" do
|
|
69
73
|
confine_block :except, :platform => /windows|solaris|osx/ do
|
70
74
|
step "#check_for_package will return false if the specified package is not installed on the remote host" do
|
71
75
|
result = check_for_package default, "non-existent-package-name"
|
76
|
+
|
72
77
|
assert !result
|
73
78
|
end
|
74
79
|
|
75
80
|
step "#check_for_package will return true if the specified package is installed on the remote host" do
|
76
81
|
install_package default, known_installed_package
|
77
82
|
result = check_for_package default, known_installed_package
|
83
|
+
|
78
84
|
assert result
|
79
85
|
end
|
80
86
|
|
@@ -43,6 +43,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
43
43
|
create_remote_file_with_backups default, remote_filename, contents
|
44
44
|
|
45
45
|
remote_contents = on(default, "cat #{remote_filename}").stdout
|
46
|
+
|
46
47
|
assert_equal contents, remote_contents
|
47
48
|
end
|
48
49
|
|
@@ -54,6 +55,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
54
55
|
create_remote_file_with_backups default, remote_filename, contents, { :protocol => "scp" }
|
55
56
|
|
56
57
|
remote_contents = on(default, "cat #{remote_filename}").stdout
|
58
|
+
|
57
59
|
assert_equal contents, remote_contents
|
58
60
|
end
|
59
61
|
|
@@ -72,6 +74,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
72
74
|
|
73
75
|
hosts.each do |host|
|
74
76
|
remote_contents = on(host, "cat #{remote_filename}").stdout
|
77
|
+
|
75
78
|
assert_equal contents, remote_contents
|
76
79
|
end
|
77
80
|
end
|
@@ -91,6 +94,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
91
94
|
|
92
95
|
hosts.each do |host|
|
93
96
|
remote_contents = on(host, "cat #{remote_filename}").stdout
|
97
|
+
|
94
98
|
assert_equal contents, remote_contents
|
95
99
|
end
|
96
100
|
end
|
@@ -144,6 +148,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
144
148
|
"contents" => contents,
|
145
149
|
"result" => result) do
|
146
150
|
remote_contents = on(default, "cat #{remote_filename}").stdout
|
151
|
+
|
147
152
|
assert_equal contents, remote_contents
|
148
153
|
end
|
149
154
|
end
|
@@ -171,6 +176,7 @@ test_name "dsl::helpers::host_helpers #create_remote_file" do
|
|
171
176
|
"contents" => contents,
|
172
177
|
"result" => result) do
|
173
178
|
remote_contents = on(host, "cat #{remote_filename}").stdout
|
179
|
+
|
174
180
|
assert_equal contents, remote_contents
|
175
181
|
end
|
176
182
|
end
|
@@ -25,6 +25,7 @@ test_name "dsl::helpers::host_helpers #curl_on" do
|
|
25
25
|
|
26
26
|
assert_equal 0, result.exit_code
|
27
27
|
remote_contents = on(default, "cat #{remote_targetfilename}").stdout
|
28
|
+
|
28
29
|
assert_equal contents, remote_contents
|
29
30
|
end
|
30
31
|
|
@@ -42,6 +43,7 @@ test_name "dsl::helpers::host_helpers #curl_on" do
|
|
42
43
|
|
43
44
|
hosts.each do |host|
|
44
45
|
remote_contents = on(host, "cat #{remote_targetfilename}").stdout
|
46
|
+
|
45
47
|
assert_equal contents, remote_contents
|
46
48
|
end
|
47
49
|
end
|
@@ -3,11 +3,13 @@ require "helpers/test_helper"
|
|
3
3
|
test_name "dsl::helpers::host_helpers #echo_on" do
|
4
4
|
step "#echo_on echoes the supplied string on the remote host" do
|
5
5
|
output = echo_on(default, "contents")
|
6
|
-
|
6
|
+
|
7
|
+
assert_equal("contents", output)
|
7
8
|
end
|
8
9
|
|
9
10
|
step "#echo_on echoes the supplied string on all hosts when given a hosts array" do
|
10
11
|
results = echo_on(hosts, "contents")
|
12
|
+
|
11
13
|
assert_equal ["contents"] * hosts.size, results
|
12
14
|
end
|
13
15
|
end
|
@@ -9,24 +9,29 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
9
9
|
|
10
10
|
step "#on makes command output available via `.stdout` on success" do
|
11
11
|
output = on(default, %{echo "echo via on"}).stdout
|
12
|
+
|
12
13
|
assert_equal "echo via on\n", output
|
13
14
|
end
|
14
15
|
|
15
16
|
step "#on makes command error output available via `.stderr` on success" do
|
16
17
|
output = on(default, "/bin/nonexistent-command", :acceptable_exit_codes => [0, 127]).stderr
|
18
|
+
|
17
19
|
assert_match(/No such file/, output)
|
18
20
|
end
|
19
21
|
|
20
22
|
step "#on makes exit status available via `.exit_code`" do
|
21
23
|
status = on(default, %{echo "echo via on"}).exit_code
|
24
|
+
|
22
25
|
assert_equal 0, status
|
23
26
|
end
|
24
27
|
|
25
28
|
step "#on with :acceptable_exit_codes will not fail for named exit codes" do
|
26
29
|
result = on default, "/bin/nonexistent-command", :acceptable_exit_codes => [0, 127]
|
27
30
|
output = result.stderr
|
31
|
+
|
28
32
|
assert_match(/No such file/, output)
|
29
33
|
status = result.exit_code
|
34
|
+
|
30
35
|
assert_equal 127, status
|
31
36
|
end
|
32
37
|
|
@@ -59,6 +64,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
59
64
|
|
60
65
|
# and that we have |hosts| distinct outputs
|
61
66
|
unique_outputs = results.map(&:output).uniq
|
67
|
+
|
62
68
|
assert_equal hosts.size, unique_outputs.size
|
63
69
|
end
|
64
70
|
|
@@ -78,6 +84,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
78
84
|
|
79
85
|
# and that we have |hosts| distinct outputs
|
80
86
|
unique_outputs = results.map(&:output).uniq
|
87
|
+
|
81
88
|
assert_equal hosts.size, unique_outputs.size
|
82
89
|
end
|
83
90
|
|
@@ -97,6 +104,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
97
104
|
|
98
105
|
# and that we have |hosts| distinct outputs
|
99
106
|
unique_outputs = results.map(&:output).uniq
|
107
|
+
|
100
108
|
assert_equal hosts.size, unique_outputs.size
|
101
109
|
end
|
102
110
|
|
@@ -112,7 +120,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
112
120
|
|
113
121
|
parent_pid = Process.pid
|
114
122
|
results = on(hosts, %{echo "${RANDOM}:${RANDOM}:${RANDOM}"}, :run_in_parallel => true) do
|
115
|
-
|
123
|
+
refute_equal(Process.pid, parent_pid)
|
116
124
|
end
|
117
125
|
|
118
126
|
# assert that we got results back for every host
|
@@ -125,6 +133,7 @@ test_name "dsl::helpers::host_helpers #on" do
|
|
125
133
|
|
126
134
|
# and that we have |hosts| distinct outputs
|
127
135
|
unique_outputs = results.map(&:output).uniq
|
136
|
+
|
128
137
|
assert_equal hosts.size, unique_outputs.size
|
129
138
|
end
|
130
139
|
|
@@ -19,6 +19,7 @@ test_name "dsl::helpers::host_helpers #retry_on" do
|
|
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
23
|
assert_equal 0, result.exit_code
|
23
24
|
assert_equal "", result.stdout
|
24
25
|
end
|
@@ -130,6 +130,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
130
130
|
"remote_tmdir" => remote_tmpdir,
|
131
131
|
"result" => result.inspect) do
|
132
132
|
remote_contents = on(default, "cat #{remote_filename}").stdout
|
133
|
+
|
133
134
|
assert_equal contents, remote_contents
|
134
135
|
end
|
135
136
|
end
|
@@ -154,6 +155,7 @@ test_name "dsl::helpers::host_helpers #rsync_to" do
|
|
154
155
|
"remote_tmdir" => remote_tmpdir,
|
155
156
|
"result" => result.inspect) do
|
156
157
|
remote_contents = on(host, "cat #{remote_filename}").stdout
|
158
|
+
|
157
159
|
assert_equal contents, remote_contents
|
158
160
|
end
|
159
161
|
end
|
@@ -24,6 +24,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
24
24
|
|
25
25
|
step "#run_cron_on CURRENTLY does not fail when listing cron jobs for a user with no cron entries" do
|
26
26
|
result = run_cron_on default, :list, default['user']
|
27
|
+
|
27
28
|
assert_equal 0, result.exit_code
|
28
29
|
end
|
29
30
|
|
@@ -31,23 +32,27 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
31
32
|
# this basically requires us to add a cron entry to make this work
|
32
33
|
run_cron_on default, :add, default['user'], "* * * * * /bin/ls >/dev/null"
|
33
34
|
result = run_cron_on default, :list, default['user']
|
35
|
+
|
34
36
|
assert_equal 0, result.exit_code
|
35
37
|
assert_match %r{/bin/ls}, result.stdout
|
36
38
|
end
|
37
39
|
|
38
40
|
step "#run_cron_on CURRENTLY does not fail, but returns nil, when adding cron jobs for an unknown user" do
|
39
41
|
result = run_cron_on default, :add, "nonexistentuser", %{* * * * * /bin/echo "hello" >/dev/null}
|
42
|
+
|
40
43
|
assert_nil result
|
41
44
|
end
|
42
45
|
|
43
46
|
step "#run_cron_on CURRENTLY does not fail, but returns nil, when attempting to add a bad cron entry" do
|
44
47
|
result = run_cron_on default, :add, default['user'], "* * * * /bin/ls >/dev/null"
|
48
|
+
|
45
49
|
assert_nil result
|
46
50
|
end
|
47
51
|
|
48
52
|
step "#run_cron_on can add a cron job for a user on a host" do
|
49
53
|
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "hello" >/dev/null}
|
50
54
|
result = run_cron_on default, :list, default['user']
|
55
|
+
|
51
56
|
assert_equal 0, result.exit_code
|
52
57
|
assert_match %r{/bin/echo}, result.stdout
|
53
58
|
end
|
@@ -73,6 +78,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
73
78
|
|
74
79
|
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "quality: job 1" >/dev/null}
|
75
80
|
result = run_cron_on default, :list, default['user']
|
81
|
+
|
76
82
|
assert_match %r{quality: job 1}, result.stdout
|
77
83
|
|
78
84
|
run_cron_on default, :remove, default['user']
|
@@ -95,6 +101,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
95
101
|
end
|
96
102
|
|
97
103
|
results = run_cron_on hosts, :list, default['user']
|
104
|
+
|
98
105
|
results.each do |result|
|
99
106
|
assert_match %r{/bin/ls}, result.stdout
|
100
107
|
end
|
@@ -104,6 +111,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
104
111
|
run_cron_on hosts, :add, default['user'], "* * * * * /bin/ls >/dev/null"
|
105
112
|
|
106
113
|
results = run_cron_on hosts, :list, default['user']
|
114
|
+
|
107
115
|
results.each do |result|
|
108
116
|
assert_match %r{/bin/ls}, result.stdout
|
109
117
|
end
|
@@ -144,6 +152,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
144
152
|
# this basically requires us to add a cron entry to make this work
|
145
153
|
run_cron_on default, :add, default['user'], "* * * * * /bin/ls >/dev/null"
|
146
154
|
result = run_cron_on default, :list, default['user']
|
155
|
+
|
147
156
|
assert_equal 0, result.exit_code
|
148
157
|
assert_match %r{/bin/ls}, result.stdout
|
149
158
|
end
|
@@ -163,6 +172,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
163
172
|
step "#run_cron_on can add a cron job for a user on a host" do
|
164
173
|
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "hello" >/dev/null}
|
165
174
|
result = run_cron_on default, :list, default['user']
|
175
|
+
|
166
176
|
assert_equal 0, result.exit_code
|
167
177
|
assert_match %r{/bin/echo}, result.stdout
|
168
178
|
end
|
@@ -188,6 +198,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
188
198
|
|
189
199
|
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "quality: job 1" >/dev/null}
|
190
200
|
result = run_cron_on default, :list, default['user']
|
201
|
+
|
191
202
|
assert_match %r{quality: job 1}, result.stdout
|
192
203
|
|
193
204
|
run_cron_on default, :remove, default['user']
|
@@ -210,6 +221,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
210
221
|
end
|
211
222
|
|
212
223
|
results = run_cron_on hosts, :list, default['user']
|
224
|
+
|
213
225
|
results.each do |result|
|
214
226
|
assert_match %r{/bin/ls}, result.stdout
|
215
227
|
end
|
@@ -219,6 +231,7 @@ test_name "dsl::helpers::host_helpers #run_cron_on" do
|
|
219
231
|
run_cron_on hosts, :add, default['user'], "* * * * * /bin/ls >/dev/null"
|
220
232
|
|
221
233
|
results = run_cron_on hosts, :list, default['user']
|
234
|
+
|
222
235
|
results.each do |result|
|
223
236
|
assert_match %r{/bin/ls}, result.stdout
|
224
237
|
end
|
@@ -22,6 +22,7 @@ test_name "dsl::helpers::host_helpers #run_script_on" do
|
|
22
22
|
local_filename, _contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
23
23
|
|
24
24
|
result = run_script_on default, local_filename, { :accept_all_exit_codes => true }
|
25
|
+
|
25
26
|
assert_equal 1, result.exit_code
|
26
27
|
end
|
27
28
|
end
|
@@ -31,6 +32,7 @@ test_name "dsl::helpers::host_helpers #run_script_on" do
|
|
31
32
|
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
32
33
|
|
33
34
|
results = run_script_on default, local_filename
|
35
|
+
|
34
36
|
assert_equal 0, results.exit_code
|
35
37
|
assert_equal "output\n", results.stdout
|
36
38
|
end
|
@@ -22,6 +22,7 @@ test_name "dsl::helpers::host_helpers #run_script" do
|
|
22
22
|
local_filename, _contents = create_local_file_from_fixture("failing_shell_script", local_dir, "testfile.sh", "a+x")
|
23
23
|
|
24
24
|
result = run_script local_filename, { :accept_all_exit_codes => true }
|
25
|
+
|
25
26
|
assert_equal 1, result.exit_code
|
26
27
|
end
|
27
28
|
end
|
@@ -31,6 +32,7 @@ test_name "dsl::helpers::host_helpers #run_script" do
|
|
31
32
|
local_filename, _contents = create_local_file_from_fixture("shell_script_with_output", local_dir, "testfile.sh", "a+x")
|
32
33
|
|
33
34
|
results = run_script local_filename
|
35
|
+
|
34
36
|
assert_equal 0, results.exit_code
|
35
37
|
assert_equal "output\n", results.stdout
|
36
38
|
end
|
@@ -28,6 +28,7 @@ test_name "dsl::helpers::host_helpers #scp_from" do
|
|
28
28
|
scp_from default, remote_filename, local_dir
|
29
29
|
|
30
30
|
local_filename = File.join(local_dir, "testfile.txt")
|
31
|
+
|
31
32
|
assert_equal contents, File.read(local_filename)
|
32
33
|
end
|
33
34
|
end
|
@@ -47,6 +48,7 @@ test_name "dsl::helpers::host_helpers #scp_from" do
|
|
47
48
|
|
48
49
|
local_filename = File.join(local_dir, "testfile.txt")
|
49
50
|
local_contents = File.read(local_filename)
|
51
|
+
|
50
52
|
assert_equal remote_contents, local_contents
|
51
53
|
end
|
52
54
|
end
|
@@ -30,6 +30,7 @@ test_name "dsl::helpers::host_helpers #scp_to" do
|
|
30
30
|
|
31
31
|
remote_filename = File.join(remote_tmpdir, "testfile.txt")
|
32
32
|
remote_contents = on(default, "cat #{remote_filename}").stdout
|
33
|
+
|
33
34
|
assert_equal contents, remote_contents
|
34
35
|
end
|
35
36
|
end
|
@@ -46,6 +47,7 @@ test_name "dsl::helpers::host_helpers #scp_to" do
|
|
46
47
|
|
47
48
|
hosts.each do |host|
|
48
49
|
remote_contents = on(host, "cat #{remote_filename}").stdout
|
50
|
+
|
49
51
|
assert_equal contents, remote_contents
|
50
52
|
end
|
51
53
|
end
|
@@ -9,24 +9,29 @@ test_name "dsl::helpers::host_helpers #shell" do
|
|
9
9
|
|
10
10
|
step "#shell makes command output available via `.stdout` on success" do
|
11
11
|
output = shell(%{echo "echo via on"}).stdout
|
12
|
+
|
12
13
|
assert_equal "echo via on\n", output
|
13
14
|
end
|
14
15
|
|
15
16
|
step "#shell makes command error output available via `.stderr` on success" do
|
16
17
|
output = shell("/bin/nonexistent-command", :acceptable_exit_codes => [0, 127]).stderr
|
18
|
+
|
17
19
|
assert_match(/No such file/, output)
|
18
20
|
end
|
19
21
|
|
20
22
|
step "#shell makes exit status available via `.exit_code`" do
|
21
23
|
status = shell(%{echo "echo via on"}).exit_code
|
24
|
+
|
22
25
|
assert_equal 0, status
|
23
26
|
end
|
24
27
|
|
25
28
|
step "#shell with :acceptable_exit_codes will not fail for named exit codes" do
|
26
29
|
result = shell "/bin/nonexistent-command", :acceptable_exit_codes => [0, 127]
|
27
30
|
output = result.stderr
|
31
|
+
|
28
32
|
assert_match(/No such file/, output)
|
29
33
|
status = result.exit_code
|
34
|
+
|
30
35
|
assert_equal 127, status
|
31
36
|
end
|
32
37
|
|
@@ -42,6 +42,7 @@ test_name "dsl::helpers::host_helpers #upgrade_package" do
|
|
42
42
|
# > No Packages marked for Update
|
43
43
|
|
44
44
|
result = upgrade_package default, "non-existent-package-name"
|
45
|
+
|
45
46
|
assert_match(/No Packages marked for Update/i, result)
|
46
47
|
end
|
47
48
|
end
|
@@ -60,6 +61,7 @@ test_name "dsl::helpers::host_helpers #upgrade_package" do
|
|
60
61
|
|
61
62
|
install_package default, "rsync"
|
62
63
|
upgrade_package default, "rsync"
|
64
|
+
|
63
65
|
assert check_for_package(default, "rsync"), "package was not successfully installed/upgraded"
|
64
66
|
end
|
65
67
|
|
@@ -11,6 +11,7 @@ test_name 'File Test' do
|
|
11
11
|
tmpfile = host.tmpfile('beaker')
|
12
12
|
# ensure we have a user to chown to
|
13
13
|
host.chown('testuser', tmpfile)
|
14
|
+
|
14
15
|
assert_match(/testuser/, host.ls_ld(tmpfile), "Should have found testuser in `ls -ld` output")
|
15
16
|
end
|
16
17
|
end
|
@@ -21,6 +22,7 @@ test_name 'File Test' do
|
|
21
22
|
tmpdir = host.tmpdir('beaker')
|
22
23
|
# ensure we have a user to chown to
|
23
24
|
host.chgrp('testgroup', tmpdir)
|
25
|
+
|
24
26
|
assert_match(/testgroup/, host.ls_ld(tmpdir), "Should have found testgroup in `ls -ld` output")
|
25
27
|
end
|
26
28
|
end
|
@@ -31,6 +33,7 @@ test_name 'File Test' do
|
|
31
33
|
tmpdir = host.tmpdir('beaker')
|
32
34
|
on host, host.touch("#{tmpdir}/somefile.txt", false)
|
33
35
|
host.chown('testuser', tmpdir, true)
|
36
|
+
|
34
37
|
assert_match(/testuser/, host.ls_ld("#{tmpdir}/somefile.txt"), "Should have found testuser in `ls -ld` output for sub-file")
|
35
38
|
end
|
36
39
|
end
|
@@ -41,6 +44,7 @@ test_name 'File Test' do
|
|
41
44
|
tmpfile = host.tmpfile('beaker')
|
42
45
|
# ensure we have a group to chgrp to
|
43
46
|
host.chgrp('testgroup', tmpfile)
|
47
|
+
|
44
48
|
assert_match(/testgroup/, host.ls_ld(tmpfile), "Should have found testgroup in `ls -ld` output")
|
45
49
|
end
|
46
50
|
end
|
@@ -51,6 +55,7 @@ test_name 'File Test' do
|
|
51
55
|
tmpdir = host.tmpdir('beaker')
|
52
56
|
# ensure we have a group to chgrp to
|
53
57
|
host.chgrp('testgroup', tmpdir)
|
58
|
+
|
54
59
|
assert_match(/testgroup/, host.ls_ld(tmpdir), "Should have found testgroup in `ls -ld` output")
|
55
60
|
end
|
56
61
|
end
|
@@ -61,6 +66,7 @@ test_name 'File Test' do
|
|
61
66
|
tmpdir = host.tmpdir('beaker')
|
62
67
|
on host, host.touch("#{tmpdir}/somefile.txt", false)
|
63
68
|
host.chgrp('testgroup', tmpdir, true)
|
69
|
+
|
64
70
|
assert_match(/testgroup/, host.ls_ld("#{tmpdir}/somefile.txt"), "Should have found testgroup in `ls -ld` output for sub-file")
|
65
71
|
end
|
66
72
|
end
|
@@ -69,6 +75,7 @@ test_name 'File Test' do
|
|
69
75
|
hosts.each do |host|
|
70
76
|
# create a tmp file to mangle
|
71
77
|
tmpdir = host.tmpdir('beaker')
|
78
|
+
|
72
79
|
assert_match(/beaker/, host.ls_ld(tmpdir), "Should have found beaker in `ls -ld` output")
|
73
80
|
end
|
74
81
|
end
|
@@ -5,8 +5,10 @@ test_name "confirm host object behave correctly"
|
|
5
5
|
step "#port_open? : can determine if a port is open on hosts"
|
6
6
|
hosts.each do |host|
|
7
7
|
logger.debug "port 22 (ssh) should be open on #{host}"
|
8
|
+
|
8
9
|
assert_equal(true, host.port_open?(22), "port 22 on #{host} should be open")
|
9
10
|
logger.debug "port 65535 should be closed on #{host}"
|
11
|
+
|
10
12
|
assert_equal(false, host.port_open?(65535), "port 65535 on #{host} should be closed")
|
11
13
|
end
|
12
14
|
|
@@ -15,6 +17,7 @@ hosts.each do |host|
|
|
15
17
|
ip = host.ip
|
16
18
|
# confirm ip format
|
17
19
|
logger.debug("format of #{ip} for #{host} should be correct")
|
20
|
+
|
18
21
|
assert_match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/, ip, "#{ip} on #{host} isn't correct format")
|
19
22
|
end
|
20
23
|
|
@@ -62,7 +65,8 @@ hosts.each do |host|
|
|
62
65
|
host.add_env_var(env_param1, env_value3)
|
63
66
|
|
64
67
|
val = host.get_env_var(env_id)
|
65
|
-
|
68
|
+
|
69
|
+
assert_equal('', val, 'get_env_var should not match a partial env key name')
|
66
70
|
end
|
67
71
|
|
68
72
|
step "#get_env_var : should not return a match from a key\'s value"
|
@@ -75,7 +79,8 @@ hosts.each do |host|
|
|
75
79
|
host.add_env_var(env_param1, env_value1)
|
76
80
|
|
77
81
|
val = host.get_env_var(env_value1)
|
78
|
-
|
82
|
+
|
83
|
+
assert_equal('', val, 'get_env_var should not return a match from a key\'s value')
|
79
84
|
end
|
80
85
|
|
81
86
|
step "#clear_env_var : should only remove the specified key"
|
@@ -99,11 +104,14 @@ hosts.each do |host|
|
|
99
104
|
host.clear_env_var(env_param3)
|
100
105
|
|
101
106
|
val = host.get_env_var(env_param1)
|
107
|
+
|
102
108
|
assert_match(/^#{env_param1}=#{env_value1}$/, val, "#{env_param1} should exist after calling clear_env_var")
|
103
109
|
val = host.get_env_var(env_param2)
|
110
|
+
|
104
111
|
assert_match(/^#{env_param2}=#{env_value2}$/, val, "#{env_param2} should exist after calling clear_env_var")
|
105
112
|
val = host.get_env_var(env_param3)
|
106
|
-
|
113
|
+
|
114
|
+
assert_equal('', val, "#{env_param3} should not exist after calling clear_env_var")
|
107
115
|
end
|
108
116
|
|
109
117
|
step "#add_env_var : can add a unique environment variable"
|
@@ -126,10 +134,13 @@ hosts.each do |host|
|
|
126
134
|
host.add_env_var(env_param3, env_value3)
|
127
135
|
|
128
136
|
val = host.get_env_var(env_param1)
|
137
|
+
|
129
138
|
assert_match(/^#{env_param1}=#{env_value1}$/, val, "#{env_param1} should exist")
|
130
139
|
val = host.get_env_var(env_param2)
|
140
|
+
|
131
141
|
assert_match(/^#{env_param2}=#{env_value2}$/, val, "#{env_param2} should exist")
|
132
142
|
val = host.get_env_var(env_param3)
|
143
|
+
|
133
144
|
assert_match(/^#{env_param3}=#{env_value3}$/, val, "#{env_param3} should exist")
|
134
145
|
end
|
135
146
|
|
@@ -147,6 +158,7 @@ hosts.each do |host|
|
|
147
158
|
host.add_env_var("TEST", "3")
|
148
159
|
logger.debug("ensure that TEST env var has correct setting")
|
149
160
|
val = host.get_env_var("TEST")
|
161
|
+
|
150
162
|
assert_match(/TEST=3(;|:)2(;|:)1$/, val, "add_env_var can correctly add env vars")
|
151
163
|
end
|
152
164
|
|
@@ -169,6 +181,7 @@ step "#add_env_var : can preserve an environment between ssh connections" do
|
|
169
181
|
host.close
|
170
182
|
logger.debug("ensure that TEST env var has correct setting")
|
171
183
|
val = host.get_env_var("TEST")
|
184
|
+
|
172
185
|
assert_match(/TEST=3(;|:)2(;|:)1$/, val, "can preserve an environment between ssh connections")
|
173
186
|
end
|
174
187
|
end
|
@@ -178,14 +191,17 @@ hosts.each do |host|
|
|
178
191
|
logger.debug("remove TEST=3")
|
179
192
|
host.delete_env_var("TEST", "3")
|
180
193
|
val = host.get_env_var("TEST")
|
194
|
+
|
181
195
|
assert_match(/TEST=2(;|:)1$/, val, "delete_env_var can correctly delete part of a chained env var")
|
182
196
|
logger.debug("remove TEST=1")
|
183
197
|
host.delete_env_var("TEST", "1")
|
184
198
|
val = host.get_env_var("TEST")
|
199
|
+
|
185
200
|
assert_match(/TEST=2$/, val, "delete_env_var can correctly delete part of a chained env var")
|
186
201
|
logger.debug("remove TEST=2")
|
187
202
|
host.delete_env_var("TEST", "2")
|
188
203
|
val = host.get_env_var("TEST")
|
204
|
+
|
189
205
|
assert_equal("", val, "delete_env_var fully removes empty env var")
|
190
206
|
end
|
191
207
|
|
@@ -195,6 +211,7 @@ hosts.each do |host|
|
|
195
211
|
host.rm_rf("test1")
|
196
212
|
# test dir construction
|
197
213
|
logger.debug("create test1/test2/test3/test4")
|
214
|
+
|
198
215
|
assert_equal(true, host.mkdir_p("test1/test2/test3/test4"), "can create directory structure")
|
199
216
|
logger.debug("should be able to create a file in the new dir")
|
200
217
|
on host, host.touch("test1/test2/test3/test4/test.txt", false)
|
@@ -218,9 +235,11 @@ hosts.each do |host|
|
|
218
235
|
local_paths.each do |path|
|
219
236
|
search_name = path.gsub(/^.*fixtures\//, '') # reduce down to the path that should match
|
220
237
|
matched = host_paths.select { |check| /#{Regexp.escape(search_name)}$/.match?(check) }
|
238
|
+
|
221
239
|
assert_equal(1, matched.length, "should have found a single instance of path #{search_name}, found #{matched.length}: \n #{matched}")
|
222
240
|
host_paths = host_paths - matched
|
223
241
|
end
|
242
|
+
|
224
243
|
assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
|
225
244
|
end
|
226
245
|
end
|
@@ -251,6 +270,7 @@ hosts.each do |host|
|
|
251
270
|
end
|
252
271
|
host_paths = host_paths - matched
|
253
272
|
end
|
273
|
+
|
254
274
|
assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
|
255
275
|
end
|
256
276
|
end
|
@@ -282,6 +302,7 @@ hosts.each do |host|
|
|
282
302
|
end
|
283
303
|
host_paths = host_paths - matched
|
284
304
|
end
|
305
|
+
|
285
306
|
assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
|
286
307
|
end
|
287
308
|
end
|
@@ -326,10 +347,12 @@ step 'Ensure that a long 128+ character string with UTF-8 characters does not br
|
|
326
347
|
long_string = ('a' * 128) + "\u06FF"
|
327
348
|
on(default, "mkdir /tmp/#{long_string}")
|
328
349
|
result = on(default, 'ls /tmp')
|
329
|
-
|
350
|
+
|
351
|
+
assert_includes(result.stdout, long_string, 'Error in folder creation with long string + UTF-8 characters')
|
330
352
|
|
331
353
|
# remove the folder
|
332
354
|
on(default, "rm -rf /tmp/#{long_string}")
|
333
355
|
result = on(default, 'ls /tmp')
|
356
|
+
|
334
357
|
assert(!result.stdout.include?(long_string), 'Error in folder deletion with long string + UTF-8 characters')
|
335
358
|
end
|
@@ -8,7 +8,7 @@ test_name "confirm host prebuilt steps behave correctly" do
|
|
8
8
|
|
9
9
|
step "confirm PATH env variable is set in the ssh environment file" do
|
10
10
|
hosts.each do |host|
|
11
|
-
|
11
|
+
assert_equal(0, on(host, "grep \"PATH\" #{host[:ssh_env_file]}").exit_code)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -16,7 +16,7 @@ test_name "confirm host prebuilt steps behave correctly" do
|
|
16
16
|
confine_block :to, :platform => /solaris-10/ do
|
17
17
|
step "confirm /opt/csw/bin has been added to the path" do
|
18
18
|
hosts.each do |host|
|
19
|
-
|
19
|
+
assert_equal(0, on(host, "grep \"/opt/csw/bin\" #{host[:ssh_env_file]}").exit_code)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -24,7 +24,7 @@ test_name "confirm host prebuilt steps behave correctly" do
|
|
24
24
|
confine_block :to, :platform => /openbsd/ do
|
25
25
|
step "confirm PKG_PATH is set in the ssh environment file" do
|
26
26
|
hosts.each do |host|
|
27
|
-
|
27
|
+
assert_equal(0, on(host, "grep \"PKG_PATH\" #{host[:ssh_env_file]}").exit_code)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/beaker.gemspec
CHANGED
@@ -27,19 +27,22 @@ Gem::Specification.new do |s|
|
|
27
27
|
# Run time dependencies
|
28
28
|
s.add_runtime_dependency 'minitar', '~> 0.6'
|
29
29
|
s.add_runtime_dependency 'minitest', '~> 5.4'
|
30
|
-
s.add_runtime_dependency 'rexml'
|
30
|
+
s.add_runtime_dependency 'rexml', '~> 3.2', '>= 3.2.5'
|
31
|
+
|
32
|
+
# net-ssh compatibility with ed25519 keys
|
33
|
+
s.add_runtime_dependency 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
|
34
|
+
s.add_runtime_dependency 'ed25519', '>= 1.2', '<2.0'
|
31
35
|
|
32
|
-
s.add_runtime_dependency 'ed25519', '~> 1.0' # net-ssh compatibility with ed25519 keys
|
33
36
|
s.add_runtime_dependency 'hocon', '~> 1.0'
|
34
37
|
s.add_runtime_dependency 'inifile', '~> 3.0'
|
35
38
|
s.add_runtime_dependency 'net-scp', '>= 1.2', '< 5.0'
|
36
|
-
s.add_runtime_dependency 'net-ssh', '
|
39
|
+
s.add_runtime_dependency 'net-ssh', '~> 7.1'
|
37
40
|
|
38
41
|
s.add_runtime_dependency 'in-parallel', '>= 0.1', '< 2.0'
|
39
42
|
s.add_runtime_dependency 'rsync', '~> 1.0.9'
|
40
43
|
s.add_runtime_dependency 'thor', ['>= 1.0.1', '< 2.0']
|
41
44
|
|
42
45
|
# Run time dependencies that are Beaker libraries
|
43
|
-
s.add_runtime_dependency 'beaker-hostgenerator'
|
46
|
+
s.add_runtime_dependency 'beaker-hostgenerator', '~> 2.0'
|
44
47
|
s.add_runtime_dependency 'stringify-hash', '~> 0.0'
|
45
48
|
end
|
data/lib/beaker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fakefs
|
@@ -98,30 +98,62 @@ dependencies:
|
|
98
98
|
name: rexml
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.2'
|
101
104
|
- - ">="
|
102
105
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
106
|
+
version: 3.2.5
|
104
107
|
type: :runtime
|
105
108
|
prerelease: false
|
106
109
|
version_requirements: !ruby/object:Gem::Requirement
|
107
110
|
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '3.2'
|
108
114
|
- - ">="
|
109
115
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
116
|
+
version: 3.2.5
|
111
117
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
118
|
+
name: bcrypt_pbkdf
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
114
120
|
requirements:
|
115
|
-
- - "
|
121
|
+
- - ">="
|
116
122
|
- !ruby/object:Gem::Version
|
117
123
|
version: '1.0'
|
124
|
+
- - "<"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '2.0'
|
118
127
|
type: :runtime
|
119
128
|
prerelease: false
|
120
129
|
version_requirements: !ruby/object:Gem::Requirement
|
121
130
|
requirements:
|
122
|
-
- - "
|
131
|
+
- - ">="
|
123
132
|
- !ruby/object:Gem::Version
|
124
133
|
version: '1.0'
|
134
|
+
- - "<"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '2.0'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: ed25519
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '1.2'
|
144
|
+
- - "<"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '2.0'
|
147
|
+
type: :runtime
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '1.2'
|
154
|
+
- - "<"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '2.0'
|
125
157
|
- !ruby/object:Gem::Dependency
|
126
158
|
name: hocon
|
127
159
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,16 +206,16 @@ dependencies:
|
|
174
206
|
name: net-ssh
|
175
207
|
requirement: !ruby/object:Gem::Requirement
|
176
208
|
requirements:
|
177
|
-
- - "
|
209
|
+
- - "~>"
|
178
210
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
211
|
+
version: '7.1'
|
180
212
|
type: :runtime
|
181
213
|
prerelease: false
|
182
214
|
version_requirements: !ruby/object:Gem::Requirement
|
183
215
|
requirements:
|
184
|
-
- - "
|
216
|
+
- - "~>"
|
185
217
|
- !ruby/object:Gem::Version
|
186
|
-
version: '
|
218
|
+
version: '7.1'
|
187
219
|
- !ruby/object:Gem::Dependency
|
188
220
|
name: in-parallel
|
189
221
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,16 +274,16 @@ dependencies:
|
|
242
274
|
name: beaker-hostgenerator
|
243
275
|
requirement: !ruby/object:Gem::Requirement
|
244
276
|
requirements:
|
245
|
-
- - "
|
277
|
+
- - "~>"
|
246
278
|
- !ruby/object:Gem::Version
|
247
|
-
version: '0'
|
279
|
+
version: '2.0'
|
248
280
|
type: :runtime
|
249
281
|
prerelease: false
|
250
282
|
version_requirements: !ruby/object:Gem::Requirement
|
251
283
|
requirements:
|
252
|
-
- - "
|
284
|
+
- - "~>"
|
253
285
|
- !ruby/object:Gem::Version
|
254
|
-
version: '0'
|
286
|
+
version: '2.0'
|
255
287
|
- !ruby/object:Gem::Dependency
|
256
288
|
name: stringify-hash
|
257
289
|
requirement: !ruby/object:Gem::Requirement
|