beaker 2.31.0 → 2.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +295 -2
- data/acceptance/fixtures/package/deb/pl-puppetserver-latest-wily.list +1 -0
- data/acceptance/tests/base/packages_unix.rb +25 -14
- data/docs/Example-Vagrant-Hosts-Files.md +0 -6
- data/docs/How-to-Write-a-Beaker-Test-for-a-Module.md +4 -145
- data/docs/README.md +1 -1
- data/docs/beaker-vs.-beaker-rspec.md +55 -46
- data/lib/beaker/command_factory.rb +12 -0
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +1 -1
- data/lib/beaker/dsl/install_utils/foss_utils.rb +73 -265
- data/lib/beaker/dsl/install_utils/puppet_utils.rb +1 -1
- data/lib/beaker/dsl/install_utils/windows_utils.rb +16 -11
- data/lib/beaker/host.rb +4 -2
- data/lib/beaker/host/eos.rb +6 -3
- data/lib/beaker/host/freebsd/pkg.rb +6 -11
- data/lib/beaker/host/mac.rb +49 -0
- data/lib/beaker/host/pswindows.rb +19 -8
- data/lib/beaker/host/pswindows/file.rb +4 -6
- data/lib/beaker/host/unix.rb +121 -0
- data/lib/beaker/host/unix/file.rb +127 -0
- data/lib/beaker/host/unix/pkg.rb +0 -8
- data/lib/beaker/host/windows.rb +50 -0
- data/lib/beaker/host/windows/file.rb +27 -0
- data/lib/beaker/host_prebuilt_steps.rb +3 -2
- data/lib/beaker/hypervisor/aws_sdk.rb +21 -8
- data/lib/beaker/options/parser.rb +102 -127
- data/lib/beaker/options/presets.rb +2 -0
- data/lib/beaker/options/validator.rb +140 -0
- data/lib/beaker/platform.rb +3 -2
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +3 -3
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +189 -311
- data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +109 -39
- data/spec/beaker/host/eos_spec.rb +5 -5
- data/spec/beaker/host/freebsd/pkg_spec.rb +53 -0
- data/spec/beaker/host/mac_spec.rb +82 -0
- data/spec/beaker/host/pswindows_spec.rb +36 -0
- data/spec/beaker/host/unix/file_spec.rb +150 -0
- data/spec/beaker/host/unix_spec.rb +208 -0
- data/spec/beaker/host/windows_spec.rb +80 -0
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +25 -7
- data/spec/beaker/options/parser_spec.rb +202 -152
- data/spec/beaker/options/validator_spec.rb +180 -0
- data/spec/beaker/ssh_connection_spec.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWVjNWUyNmQ5ZTc2OWUxZGZiNDU0NTA3NTc3OTg1MzgzY2QwNjNhMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2M4ZmYzZDA0ZGFmMjBhMGNiNWI5YWJhNDk0MDJhNjM5MzMxMmUyNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDRmZTQ0YzgzYjM2YjU2NWQ2Njc0MTQyZWM1MDJlMmRmN2M0NTM5Njk3NjU0
|
10
|
+
MGJhNWVkMzZiM2M3ZmZhZWI5YjIwYTNiZjUyMmViZmVkYmM0MGU5NjE5MTlm
|
11
|
+
ZDg3Y2ZkODU5ODU4MjJjY2FjMTUxZTY1MzYyNDQ1NjE2MjcyYzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2MwZTMxNDYxYmQwNTZhMzcxYWFjNjFkMDYwNjJjMzE0ZGY3ZjEzYjY5N2Ez
|
14
|
+
NWIzMWU5OTZjMzViOTQ2OWFjMzE3MDFiZjlmNmViM2NjZDk0NzQyZGU5MWY3
|
15
|
+
OTRlNWFkMjQxYTA4YjlhMzgxY2EzODI0YTZiMTJlZWYzMzUxMTg=
|
data/HISTORY.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# default - History
|
2
2
|
## Tags
|
3
|
-
* [LATEST -
|
3
|
+
* [LATEST - 12 Jan, 2016 (15967483)](#LATEST)
|
4
|
+
* [2.31.0 - 16 Dec, 2015 (54b1801d)](#2.31.0)
|
4
5
|
* [2.30.1 - 3 Dec, 2015 (9f1376ef)](#2.30.1)
|
5
6
|
* [2.30.0 - 2 Dec, 2015 (dbb72630)](#2.30.0)
|
6
7
|
* [2.29.1 - 23 Nov, 2015 (5d824690)](#2.29.1)
|
@@ -105,7 +106,299 @@
|
|
105
106
|
* [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
|
106
107
|
|
107
108
|
## Details
|
108
|
-
### <a name = "LATEST">LATEST -
|
109
|
+
### <a name = "LATEST">LATEST - 12 Jan, 2016 (15967483)
|
110
|
+
|
111
|
+
* (GEM) update beaker version to 2.32.0 (15967483)
|
112
|
+
|
113
|
+
* Merge pull request #1044 from kevpl/bkr648_puppetagent_singleinstall (d0d87438)
|
114
|
+
|
115
|
+
|
116
|
+
```
|
117
|
+
Merge pull request #1044 from kevpl/bkr648_puppetagent_singleinstall
|
118
|
+
|
119
|
+
(BKR-648) Refactored to simplify puppet-agent installation
|
120
|
+
```
|
121
|
+
* Merge pull request #1043 from timhughes/patch-1 (4a42e63c)
|
122
|
+
|
123
|
+
|
124
|
+
```
|
125
|
+
Merge pull request #1043 from timhughes/patch-1
|
126
|
+
|
127
|
+
(MAINT) Correcting method name in docs
|
128
|
+
```
|
129
|
+
* Merge pull request #1041 from petems/BKR-661-fix_freebsd9_packages (8898edf0)
|
130
|
+
|
131
|
+
|
132
|
+
```
|
133
|
+
Merge pull request #1041 from petems/BKR-661-fix_freebsd9_packages
|
134
|
+
|
135
|
+
(BKR-661) Change to use pkgng for package installs
|
136
|
+
```
|
137
|
+
* Merge pull request #1042 from colinPL/bkr88_breakout (74bac25a)
|
138
|
+
|
139
|
+
|
140
|
+
```
|
141
|
+
Merge pull request #1042 from colinPL/bkr88_breakout
|
142
|
+
|
143
|
+
(BKR-88) Split Validation Out Of Options Parser
|
144
|
+
```
|
145
|
+
* Merge pull request #1038 from DavidS/maint-docs-update-beaker-rspec (360307b7)
|
146
|
+
|
147
|
+
|
148
|
+
```
|
149
|
+
Merge pull request #1038 from DavidS/maint-docs-update-beaker-rspec
|
150
|
+
|
151
|
+
(MAINT) improve beaker-rspec docs
|
152
|
+
```
|
153
|
+
* Merge pull request #1035 from LuvCurves/master (9cbed436)
|
154
|
+
|
155
|
+
|
156
|
+
```
|
157
|
+
Merge pull request #1035 from LuvCurves/master
|
158
|
+
|
159
|
+
(BKR-510) Support for EC2 Netscaler provisioning
|
160
|
+
```
|
161
|
+
* (MAINT) Correcting method name in docs (b4fee7ba)
|
162
|
+
|
163
|
+
* (BKR-88) Additional Docs (b5dddd76)
|
164
|
+
|
165
|
+
|
166
|
+
```
|
167
|
+
(BKR-88) Additional Docs
|
168
|
+
|
169
|
+
Add @raise to yard docs.
|
170
|
+
```
|
171
|
+
* (BKR-88) Remove unless Blocks (aaa8d78a)
|
172
|
+
|
173
|
+
|
174
|
+
```
|
175
|
+
(BKR-88) Remove unless Blocks
|
176
|
+
|
177
|
+
Following suggested code style, this commit removes the "unless" blocks
|
178
|
+
I introduced in favor of "if" statements using "!" instead of "not".
|
179
|
+
```
|
180
|
+
* (BKR-88) Add Tests for check_hypervisor_config (80d14079)
|
181
|
+
|
182
|
+
|
183
|
+
```
|
184
|
+
(BKR-88) Add Tests for check_hypervisor_config
|
185
|
+
|
186
|
+
Add tests for parser.check_hypervisor_config.
|
187
|
+
```
|
188
|
+
* (BKR-88) Add Tests for validate_platform (ee20aad3)
|
189
|
+
|
190
|
+
|
191
|
+
```
|
192
|
+
(BKR-88) Add Tests for validate_platform
|
193
|
+
|
194
|
+
Added spec tests for validator.validate_platform. This includes a fix
|
195
|
+
for an empty string being considered valid.
|
196
|
+
```
|
197
|
+
* (BKR-88) Specify Error Raised in Tests (65f3c49d)
|
198
|
+
|
199
|
+
|
200
|
+
```
|
201
|
+
(BKR-88) Specify Error Raised in Tests
|
202
|
+
|
203
|
+
Using raise_error without specifying the specific error causes
|
204
|
+
warning messages to be printed. This commit adds the expected error to
|
205
|
+
all raise_error calls within validator.rb.
|
206
|
+
```
|
207
|
+
* (BKR-88) Change not_to to to_not (8f9e82cb)
|
208
|
+
|
209
|
+
|
210
|
+
```
|
211
|
+
(BKR-88) Change not_to to to_not
|
212
|
+
|
213
|
+
Change "not_to" calls to "to_not" to match usage in other tests within
|
214
|
+
the codebase.
|
215
|
+
```
|
216
|
+
* (BKR-88) Add Missing Tests for Validator (6ef8998c)
|
217
|
+
|
218
|
+
|
219
|
+
```
|
220
|
+
(BKR-88) Add Missing Tests for Validator
|
221
|
+
|
222
|
+
Add tests for four more methods in Validator.
|
223
|
+
```
|
224
|
+
* (BKR-88) Yard Doc and Newline Clean-up (8f69176a)
|
225
|
+
|
226
|
+
|
227
|
+
```
|
228
|
+
(BKR-88) Yard Doc and Newline Clean-up
|
229
|
+
|
230
|
+
Add yard docs to the methods missing them in validator.rb. This also
|
231
|
+
removes empty lines between "end" portions at end of file.
|
232
|
+
```
|
233
|
+
* (BKR-88) Move resolve_symlinks and Use File Validations (3c6e7802)
|
234
|
+
|
235
|
+
|
236
|
+
```
|
237
|
+
(BKR-88) Move resolve_symlinks and Use File Validations
|
238
|
+
|
239
|
+
This commit moves the resolve_symlinks from validator to parser. The
|
240
|
+
method was also renamed to resolve_symlinks! because of its
|
241
|
+
modification of @options.
|
242
|
+
|
243
|
+
The file_list method was refactored to move all parser_error calls to
|
244
|
+
the validator class.
|
245
|
+
```
|
246
|
+
* (BKR-88) Rename Validation Methods to validate_ Prefix (d62c616f)
|
247
|
+
|
248
|
+
|
249
|
+
```
|
250
|
+
(BKR-88) Rename Validation Methods to validate_ Prefix
|
251
|
+
|
252
|
+
There are several methods in Options::Validator that ended in with a
|
253
|
+
question mark but did not return a boolean value. These have been
|
254
|
+
renamed to a "validate_" prefix and the question mark removed.
|
255
|
+
|
256
|
+
This also adds validation for file lists and file paths.
|
257
|
+
```
|
258
|
+
* (BKR-88) Remove Invalid Doc Tag (13ab3162)
|
259
|
+
|
260
|
+
|
261
|
+
```
|
262
|
+
(BKR-88) Remove Invalid Doc Tag
|
263
|
+
|
264
|
+
Remove an invalid yard doc tag.
|
265
|
+
```
|
266
|
+
* (BKR-88) Split Validation Out Of Options Parser (18ca60bb)
|
267
|
+
|
268
|
+
|
269
|
+
```
|
270
|
+
(BKR-88) Split Validation Out Of Options Parser
|
271
|
+
|
272
|
+
This commit separates the options parser from the validation piece.
|
273
|
+
This narrows the focus of Parser and makes the class smaller in code.
|
274
|
+
```
|
275
|
+
* (BKR-648) Refactored to simplify puppet-agent installation (e074def2)
|
276
|
+
|
277
|
+
* (BKR-661) Change to use pkgng for FreeBSD (09f507cc)
|
278
|
+
|
279
|
+
|
280
|
+
```
|
281
|
+
(BKR-661) Change to use pkgng for FreeBSD
|
282
|
+
|
283
|
+
* pkg_* is EOL as of Sept 2014 https://lists.freebsd.org/pipermail/freebsd-ports-announce/2014-February/000077.html
|
284
|
+
* On most base boxes, the pkg_* pointers are now 404:
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
The following SSH command responded with a non-zero exit status.
|
289
|
+
Vagrant assumes that this means the command failed!
|
290
|
+
|
291
|
+
pkg_add -r rsync
|
292
|
+
|
293
|
+
Stdout from the command:
|
294
|
+
|
295
|
+
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/rsync.tbz: File unavailable (e.g., file not found, no access)
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
* Also fixes (BK-438), as we're changing package install result to be the result, as is the same with other pkg helpers.
|
300
|
+
* Moves FreeBSD checking package code to FreeBSD specific class
|
301
|
+
* Adds spec for changes
|
302
|
+
```
|
303
|
+
* Merge pull request #1040 from puppetlabs/revert-1025-add_privatebindir_to_path (d542dbbb)
|
304
|
+
|
305
|
+
|
306
|
+
```
|
307
|
+
Merge pull request #1040 from puppetlabs/revert-1025-add_privatebindir_to_path
|
308
|
+
|
309
|
+
(BKR-660) Revert "Add privatebindir to PATH"
|
310
|
+
```
|
311
|
+
* (MAINT) improve docs (483a65c9)
|
312
|
+
|
313
|
+
|
314
|
+
```
|
315
|
+
(MAINT) improve docs
|
316
|
+
|
317
|
+
beaker-vs.-beaker-rspec.md: Wording, criteria, better example.
|
318
|
+
How-to-Write-a-Beaker-Test-for-a-Module.md: Moved to beaker-rspec repo
|
319
|
+
Example-Vagrant-Hosts-Files.md: removed redundant URLs, vagrant can talk to atlas
|
320
|
+
```
|
321
|
+
* Revert "Add privatebindir to PATH" (8e4745f1)
|
322
|
+
|
323
|
+
* Merge pull request #1039 from colinPL/bkr481_ubuntu1510 (25d1fea9)
|
324
|
+
|
325
|
+
|
326
|
+
```
|
327
|
+
Merge pull request #1039 from colinPL/bkr481_ubuntu1510
|
328
|
+
|
329
|
+
(BRK-481) Add Ubuntu 15.10 Support
|
330
|
+
```
|
331
|
+
* (BKR-481) Move SSH Presets to Presets File (62b47e32)
|
332
|
+
|
333
|
+
|
334
|
+
```
|
335
|
+
(BKR-481) Move SSH Presets to Presets File
|
336
|
+
|
337
|
+
Move the SSH presets / defaults to the file that has all of beaker's
|
338
|
+
presets.
|
339
|
+
```
|
340
|
+
* Merge pull request #1020 from kevpl/bkr604_bitvise_installpe (f3d87f2b)
|
341
|
+
|
342
|
+
|
343
|
+
```
|
344
|
+
Merge pull request #1020 from kevpl/bkr604_bitvise_installpe
|
345
|
+
|
346
|
+
(BKR-604) Windows BitVise install_pe fixes
|
347
|
+
```
|
348
|
+
* (BRK-481) Add Default SSH Options to Spec Test (cac80d79)
|
349
|
+
|
350
|
+
|
351
|
+
```
|
352
|
+
(BRK-481) Add Default SSH Options to Spec Test
|
353
|
+
|
354
|
+
Add the default SSH options added to ssh_connection to the spec tests.
|
355
|
+
```
|
356
|
+
* (BKR-481) Detect SSH Connection Termination (a55e6f47)
|
357
|
+
|
358
|
+
|
359
|
+
```
|
360
|
+
(BKR-481) Detect SSH Connection Termination
|
361
|
+
|
362
|
+
Ubuntu 15.10 does not seem to cleanly shutdown sshd, causing the ssh
|
363
|
+
client to sit around until the next write attempt. For beaker's reboot
|
364
|
+
test this write never happens.
|
365
|
+
|
366
|
+
This change adds a keep alive and keep alive timeout to the ssh client
|
367
|
+
connection to detect when the connection is severed without
|
368
|
+
notification.
|
369
|
+
|
370
|
+
This problem is not seen on Ubuntu 15.04.
|
371
|
+
```
|
372
|
+
* (maint) Clean After deploy_package_repo Test (64e9f920)
|
373
|
+
|
374
|
+
|
375
|
+
```
|
376
|
+
(maint) Clean After deploy_package_repo Test
|
377
|
+
|
378
|
+
The acceptance test for deploy_package_repo was leaving behind the
|
379
|
+
yum or source file, causing future package manager updates (apt-get
|
380
|
+
update) to encounter errors (404).
|
381
|
+
|
382
|
+
This change adds a clean-up step to the test and updates clean_file to
|
383
|
+
be more intelligent and construct a filename based on the host's
|
384
|
+
platform.
|
385
|
+
```
|
386
|
+
* (BKR-481) Add fixture for 15.10 (7ddd9ef9)
|
387
|
+
|
388
|
+
|
389
|
+
```
|
390
|
+
(BKR-481) Add fixture for 15.10
|
391
|
+
|
392
|
+
Add acceptance test package fixture to support Ubuntu 15.10. This
|
393
|
+
allows the package acceptance tests to pass on 15.10.
|
394
|
+
```
|
395
|
+
* (BKR-510) Support for EC2 Netscaler provisioning (9331a0fc)
|
396
|
+
|
397
|
+
* (BKR-604) Windows BitVise install_pe fixes (4926cf95)
|
398
|
+
|
399
|
+
### <a name = "2.31.0">2.31.0 - 16 Dec, 2015 (54b1801d)
|
400
|
+
|
401
|
+
* (HISTORY) update beaker history for gem release 2.31.0 (54b1801d)
|
109
402
|
|
110
403
|
* (GEM) update beaker version to 2.31.0 (da1729b0)
|
111
404
|
|
@@ -0,0 +1 @@
|
|
1
|
+
deb http://nightlies.puppetlabs.com/puppetserver-latest/repos/apt/wily wily PC1
|
@@ -6,8 +6,22 @@ pkg_fixtures = File.expand_path(File.join(current_dir, '../../fixtures/package')
|
|
6
6
|
pkg_name = 'puppetserver'
|
7
7
|
|
8
8
|
def clean_file(host, file)
|
9
|
-
|
10
|
-
|
9
|
+
unless file.nil?
|
10
|
+
filename = pkg_file(host, file)
|
11
|
+
|
12
|
+
if !filename.nil? && host.file_exist?(filename)
|
13
|
+
on(host, "rm -rf #{filename}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def pkg_file(host, pkg_name)
|
19
|
+
if host['platform'] =~ /debian|ubuntu/
|
20
|
+
"/etc/apt/sources.list.d/#{pkg_name}.list"
|
21
|
+
elsif host['platform'] =~ /el/
|
22
|
+
"/etc/yum.repos.d/#{pkg_name}.repo"
|
23
|
+
else
|
24
|
+
nil
|
11
25
|
end
|
12
26
|
end
|
13
27
|
|
@@ -20,12 +34,10 @@ step '#deploy_apt_repo : deploy puppet-server nightly repo'
|
|
20
34
|
hosts.each do |host|
|
21
35
|
|
22
36
|
if host['platform'] =~ /debian|ubuntu/
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
host
|
27
|
-
assert(host.file_exist?(pkg_file), 'apt file should exist')
|
28
|
-
clean_file(host, pkg_file)
|
37
|
+
clean_file(host, pkg_name)
|
38
|
+
host.deploy_apt_repo(pkg_fixtures, pkg_name, 'latest')
|
39
|
+
assert(host.file_exist?(pkg_file(host, pkg_name)), 'apt file should exist')
|
40
|
+
clean_file(host, pkg_name)
|
29
41
|
end
|
30
42
|
|
31
43
|
end
|
@@ -34,17 +46,16 @@ step '#deploy_yum_repo : deploy puppet-server nightly repo'
|
|
34
46
|
hosts.each do |host|
|
35
47
|
|
36
48
|
if host['platform'] =~ /el/
|
37
|
-
|
38
|
-
|
39
|
-
clean_file(host, pkg_file)
|
49
|
+
clean_file(host, pkg_name)
|
40
50
|
host.deploy_yum_repo(pkg_fixtures, pkg_name, 'latest')
|
41
|
-
assert(host.file_exist?(pkg_file), 'yum file should exist')
|
42
|
-
clean_file(host,
|
51
|
+
assert(host.file_exist?(pkg_file(host, pkg_name)), 'yum file should exist')
|
52
|
+
clean_file(host, pkg_name)
|
43
53
|
end
|
44
54
|
|
45
55
|
end
|
46
56
|
|
47
57
|
step '#deploy_package_repo : deploy puppet-server nightly repo'
|
48
58
|
hosts.each do |host|
|
49
|
-
host.deploy_package_repo(pkg_fixtures,
|
59
|
+
host.deploy_package_repo(pkg_fixtures, pkg_name, 'latest')
|
60
|
+
clean_file(host, pkg_name)
|
50
61
|
end
|
@@ -6,7 +6,6 @@ HOSTS:
|
|
6
6
|
- master
|
7
7
|
platform: el-5-x86_64
|
8
8
|
box: puppetlabs/centos-5.11-64-nocm
|
9
|
-
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-5.11-64-nocm
|
10
9
|
hypervisor: vagrant
|
11
10
|
```
|
12
11
|
#centos-65-x64.yml
|
@@ -17,7 +16,6 @@ HOSTS:
|
|
17
16
|
- master
|
18
17
|
platform: el-6-x86_64
|
19
18
|
box: puppetlabs/centos-6.5-64-nocm
|
20
|
-
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.5-64-nocm
|
21
19
|
hypervisor: vagrant
|
22
20
|
```
|
23
21
|
#debian-609-x64.yml
|
@@ -28,7 +26,6 @@ HOSTS:
|
|
28
26
|
- master
|
29
27
|
platform: debian-6-amd64
|
30
28
|
box: puppetlabs/debian-6.0.9-64-nocm
|
31
|
-
box_url: https://vagrantcloud.com/puppetlabs/boxes/debian-6.0.9-64-nocm
|
32
29
|
hypervisor: vagrant
|
33
30
|
```
|
34
31
|
#debian-78-x64.yml
|
@@ -39,7 +36,6 @@ HOSTS:
|
|
39
36
|
- master
|
40
37
|
platform: debian-7-amd64
|
41
38
|
box: puppetlabs/debian-7.8-64-nocm
|
42
|
-
box_url: https://vagrantcloud.com/puppetlabs/boxes/debian-7.8-64-nocm
|
43
39
|
hypervisor: vagrant
|
44
40
|
```
|
45
41
|
#ubuntu-server-1204-x64.yml
|
@@ -50,7 +46,6 @@ HOSTS:
|
|
50
46
|
- master
|
51
47
|
platform: ubuntu-1204-amd64
|
52
48
|
box: puppetlabs/ubuntu-12.04-64-nocm
|
53
|
-
box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-12.04-64-nocm
|
54
49
|
hypervisor: vagrant
|
55
50
|
```
|
56
51
|
#ubuntu-server-1404-x64.yml
|
@@ -61,6 +56,5 @@ HOSTS:
|
|
61
56
|
- master
|
62
57
|
platform: ubuntu-14.04-amd64
|
63
58
|
box: puppetlabs/ubuntu-14.04-64-nocm
|
64
|
-
box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm
|
65
59
|
hypervisor: vagrant
|
66
60
|
```
|
@@ -1,152 +1,11 @@
|
|
1
1
|
#Beaker for Modules
|
2
2
|
##Read the Beaker Docs
|
3
3
|
|
4
|
-
[Beaker How To](
|
5
|
-
|
6
|
-
<a href = "http://rubydoc.info/github/puppetlabs/beaker/frames">Beaker DSL API</a>
|
4
|
+
[Beaker How To](How-To-Beaker.md)
|
5
|
+
[Beaker DSL API](http://rubydoc.info/github/puppetlabs/beaker/frames)
|
7
6
|
|
8
7
|
##Understand the Difference Between beaker and beaker-rspec
|
9
|
-
[beaker vs. beaker-rspec](
|
8
|
+
[beaker vs. beaker-rspec](beaker-vs.-beaker-rspec.md)
|
10
9
|
|
11
10
|
##beaker-rspec Details
|
12
|
-
|
13
|
-
|
14
|
-
`BEAKER_debug` - turn on extended debug logging
|
15
|
-
|
16
|
-
`BEAKER_set` - set to the name of the node file to be used during testing (exclude .yml file extension, it will be added by beaker-rspec), assumed to be in module's spec/acceptance/nodesets directory
|
17
|
-
|
18
|
-
`BEAKER_setfile` - set to the full path to a node file be used during testing (be sure to include full path and file extensions, beaker-rspec will use this path without editing/altering it in any way)
|
19
|
-
|
20
|
-
`BEAKER_destroy` - set to `no` to preserve test boxes after testing, set to `onpass` to destroy only if tests pass
|
21
|
-
|
22
|
-
`BEAKER_provision` - set to `no` to skip provisioning boxes before testing, will then assume that boxes are already provisioned and reachable
|
23
|
-
|
24
|
-
##Typical Workflow
|
25
|
-
|
26
|
-
1. Run tests with `BEAKER_destroy=no`, no setting for `BEAKER_provision`
|
27
|
-
* beaker-rspec will use spec/acceptance/nodesets/default.yml node file
|
28
|
-
* boxes will be newly provisioned
|
29
|
-
* boxes will be preserved post-testing
|
30
|
-
* Run tests with `BEAKER_destroy=no` and `BEAKER_provision=no`
|
31
|
-
* beaker-rspec will use spec/acceptance/nodesets/default.yml node file
|
32
|
-
* boxes will be re-used from previous run
|
33
|
-
* boxes will be preserved post-testing
|
34
|
-
* Nodes become corrupted with too many test runs/bad data and need to be refreshed then GOTO step 1
|
35
|
-
* Testing is complete and you want to clean up, run once more with `BEAKER_destroy` unset
|
36
|
-
* you can also:
|
37
|
-
|
38
|
-
cd .vagrant/beaker_vagrant_files/default.yml ; vagrant destroy --force
|
39
|
-
|
40
|
-
##Building your Module Testing Environment
|
41
|
-
|
42
|
-
Using puppetlabs-mysql as an example module.
|
43
|
-
|
44
|
-
###Clone the module repository of the module that you wish to test
|
45
|
-
|
46
|
-
git clone https://github.com/puppetlabs/puppetlabs-mysql
|
47
|
-
cd puppetlabs-mysql
|
48
|
-
|
49
|
-
###Create the spec_helper_acceptance.rb
|
50
|
-
|
51
|
-
Create example file spec_helper_acceptance.rb:
|
52
|
-
```ruby
|
53
|
-
require 'beaker-rspec'
|
54
|
-
require 'pry'
|
55
|
-
|
56
|
-
hosts.each do |host|
|
57
|
-
# Install Puppet
|
58
|
-
on host, install_puppet
|
59
|
-
end
|
60
|
-
|
61
|
-
RSpec.configure do |c|
|
62
|
-
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
63
|
-
|
64
|
-
c.formatter = :documentation
|
65
|
-
|
66
|
-
# Configure all nodes in nodeset
|
67
|
-
c.before :suite do
|
68
|
-
# Install module
|
69
|
-
puppet_module_install(:source => module_root, :module_name => 'mysql',
|
70
|
-
:target_module_path => '/etc/puppet/modules')
|
71
|
-
hosts.each do |host|
|
72
|
-
on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
```
|
77
|
-
|
78
|
-
Update spec_helper_acceptance.rb to reflect the module under test. You will need to set the correct module name and add any module dependencies. Place the file in the /spec directory (in this case puppetlabs-mysql/spec)
|
79
|
-
|
80
|
-
###Install beaker-rspec
|
81
|
-
####From Gem (preferred)
|
82
|
-
|
83
|
-
gem install beaker-rspec pry
|
84
|
-
|
85
|
-
###Update the module's Gemfile
|
86
|
-
|
87
|
-
In module's top level directory edit the Gemfile. If there is a section that
|
88
|
-
begins `group :development, :test do`, then add it there.
|
89
|
-
|
90
|
-
```ruby
|
91
|
-
gem 'beaker-rspec', :require => false
|
92
|
-
gem 'pry', :require => false
|
93
|
-
```
|
94
|
-
|
95
|
-
Then run
|
96
|
-
|
97
|
-
bundle install
|
98
|
-
|
99
|
-
###Create node files
|
100
|
-
|
101
|
-
These files indicate the nodes (or hosts) that the tests will be run on. By default, any node file called `default.yml` will be used. You can override this using the `BEAKER_set` environment variable to indicate an alternate file. Do not provide full path or the '.yml' file extension to `BEAKER_set`, it is assumed to be located in 'spec/acceptance/nodesets/${NAME}.yml' by beaker-rspec. If you wish to use a completely different file location use `BEAKER_setfile` and set it to the full path (including file extension) of your hosts file.
|
102
|
-
|
103
|
-
Nodes are pulled from <a href = "https://vagrantcloud.com/puppetlabs">Puppet Labs Vagrant Boxes</a>.
|
104
|
-
|
105
|
-
Example node files can be found here:
|
106
|
-
|
107
|
-
*[Puppet Labs example Vagrant node files](Example-Vagrant-Hosts-Files.md)
|
108
|
-
|
109
|
-
Create the nodesets directory. From module's top level directory:
|
110
|
-
|
111
|
-
mkdir -p spec/acceptance/nodesets
|
112
|
-
|
113
|
-
Copy any nodesets that you wish to use into the nodesets directory.
|
114
|
-
|
115
|
-
###Create spec tests for your module
|
116
|
-
|
117
|
-
Spec tests are written in <a href = "http://rspec.info/">RSpec</a>.
|
118
|
-
|
119
|
-
Example spec file (mysql_account_delete_spec.rb):
|
120
|
-
|
121
|
-
```ruby
|
122
|
-
require 'spec_helper_acceptance'
|
123
|
-
|
124
|
-
describe 'mysql::server::account_security class' do
|
125
|
-
describe 'running puppet code' do
|
126
|
-
it 'should work with no errors' do
|
127
|
-
pp = <<-EOS
|
128
|
-
class { 'mysql::server': remove_default_accounts => true }
|
129
|
-
EOS
|
130
|
-
|
131
|
-
# Run it twice and test for idempotency
|
132
|
-
apply_manifest(pp, :catch_failures => true)
|
133
|
-
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
|
134
|
-
end
|
135
|
-
|
136
|
-
describe 'accounts' do
|
137
|
-
it 'should delete accounts' do
|
138
|
-
shell("mysql -e 'show grants for root@127.0.0.1;'", :acceptable_exit_codes => 1)
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'should delete databases' do
|
142
|
-
shell("mysql -e 'show databases;' |grep test", :acceptable_exit_codes => 1)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
```
|
148
|
-
###Run your spec tests
|
149
|
-
|
150
|
-
From module's top level directory
|
151
|
-
|
152
|
-
bundle exec rspec spec/acceptance
|
11
|
+
See the [beaker-rspec README](https://github.com/puppetlabs/beaker-rspec/blob/master/README.md) for details on how to use beaker-rspec with modules.
|