beaker 2.40.0 → 2.41.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 +8 -8
- data/HISTORY.md +225 -2
- data/README.md +14 -1
- data/acceptance/config/acceptance-options.rb +4 -1
- data/acceptance/config/puppetgem/acceptance-options.rb +7 -2
- data/acceptance/config/puppetgit/acceptance-options.rb +7 -2
- data/acceptance/config/puppetpkg/acceptance-options.rb +6 -2
- data/acceptance/pre_suite/puppet_gem/install.rb +5 -0
- data/acceptance/pre_suite/puppet_git/install.rb +5 -0
- data/acceptance/tests/base/test_suite/export.rb +13 -0
- data/acceptance/tests/puppet/with_puppet_running_on.rb +30 -0
- data/docs/Beaker-Libraries.md +7 -1
- data/docs/meta/ticket_process.md +1 -1
- data/docs/runner/test_suites.md +83 -0
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +11 -1
- data/lib/beaker/dsl/outcomes.rb +7 -0
- data/lib/beaker/host/unix/exec.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +4 -4
- data/lib/beaker/host_prebuilt_steps.rb +3 -3
- data/lib/beaker/hypervisor/docker.rb +1 -1
- data/lib/beaker/hypervisor/vmpooler.rb +16 -6
- data/lib/beaker/test_case.rb +5 -0
- data/lib/beaker/test_suite.rb +7 -0
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +32 -8
- data/spec/beaker/host/unix/pkg_spec.rb +18 -14
- data/spec/beaker/host_prebuilt_steps_spec.rb +12 -0
- data/spec/beaker/hypervisor/docker_spec.rb +13 -11
- data/spec/beaker/hypervisor/vmpooler_spec.rb +25 -3
- data/spec/beaker/test_suite_spec.rb +70 -24
- data/spec/helpers.rb +7 -2
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZjUwYTZlZjRmMzlkZmVmMDg3ZjFjMTlkMDNiOGE5MjRhMDcwYmU2MQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
MjEzZWRjNTA4NzRiM2UwYmY0NjEyNjY1MWFmNTRlYWIzYmNlYWRlNw==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Y2QxZjA0NmNiMzQxMzIyMzkzMWIwMjk1OTFjN2NiYzU2Y2MzMjIyNTQ0M2U5
|
|
10
|
+
MDlmN2NkZDBkOTA1ZDlmN2VmZWMwMTUzOTY1ZmExN2QxZjE4OTJkM2I0YTM2
|
|
11
|
+
NzI4ZmZmYTdhNjQ3NzE3NmQ1M2IxYzk3NGFiZDljNTU1NjQ2NWM=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MjlmNzJkZTc2Zjc3MGZjMjNhYWQ4YmQ4MjM1YmE0NzA0MzIzYjYxMTU0Y2Y1
|
|
14
|
+
NTQ3NTk5MzZhNjJjZGVkMDAxZjY5NTJhNGFiNzg3ODhlMzRlMDAwZGY3NzJk
|
|
15
|
+
ODQ3ZjY1MTE1ZTI5ZWFkNDI4ODJkOGI4NTllNGExMzliMWU5NDI=
|
data/HISTORY.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# default - History
|
|
2
2
|
## Tags
|
|
3
|
-
* [LATEST -
|
|
3
|
+
* [LATEST - 10 May, 2016 (859e8702)](#LATEST)
|
|
4
|
+
* [2.40.0 - 18 Apr, 2016 (0a7b948a)](#2.40.0)
|
|
4
5
|
* [2.39.0 - 6 Apr, 2016 (5976e103)](#2.39.0)
|
|
5
6
|
* [2.38.1 - 31 Mar, 2016 (124b91b8)](#2.38.1)
|
|
6
7
|
* [2.38.0 - 30 Mar, 2016 (0878bff7)](#2.38.0)
|
|
@@ -116,7 +117,229 @@
|
|
|
116
117
|
* [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
|
|
117
118
|
|
|
118
119
|
## Details
|
|
119
|
-
### <a name = "LATEST">LATEST -
|
|
120
|
+
### <a name = "LATEST">LATEST - 10 May, 2016 (859e8702)
|
|
121
|
+
|
|
122
|
+
* (GEM) update beaker version to 2.41.0 (859e8702)
|
|
123
|
+
|
|
124
|
+
* Merge pull request #1118 from tvpartytonight/BKR-684 (44e11078)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Merge pull request #1118 from tvpartytonight/BKR-684
|
|
129
|
+
|
|
130
|
+
(BKR-684) Update Beaker-Libraries doc
|
|
131
|
+
```
|
|
132
|
+
* (BKR-684) Update Beaker-Libraries doc (69689f76)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
(BKR-684) Update Beaker-Libraries doc
|
|
137
|
+
|
|
138
|
+
This PR syncs the internal confluence docs with public Github
|
|
139
|
+
documentation.
|
|
140
|
+
```
|
|
141
|
+
* Merge pull request #1105 from er0ck/fix/master/BKR-779-skip_test_broken_in_with_puppet_running_on (54dd8192)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
Merge pull request #1105 from er0ck/fix/master/BKR-779-skip_test_broken_in_with_puppet_running_on
|
|
146
|
+
|
|
147
|
+
(BKR-779) skip_test broken in with_puppet_running_on
|
|
148
|
+
```
|
|
149
|
+
* Merge pull request #1116 from petems/BKR-799-update_fedora_support (1c5a46b7)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
Merge pull request #1116 from petems/BKR-799-update_fedora_support
|
|
154
|
+
|
|
155
|
+
(BKR-799) Update Fedora support
|
|
156
|
+
```
|
|
157
|
+
* (BKR-799) Updates specs with more Fedora versions (0553e807)
|
|
158
|
+
|
|
159
|
+
* (BKR-799) Use systemd for commands from Fedora 14+ (859e8ee1)
|
|
160
|
+
|
|
161
|
+
* (BKR-799) Use dnf on Fedora from 22 onwards (020522a0)
|
|
162
|
+
|
|
163
|
+
* Merge pull request #1112 from apollo-io/solaris11-provision (5e04dbd8)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Merge pull request #1112 from apollo-io/solaris11-provision
|
|
168
|
+
|
|
169
|
+
(BKR-789) enable --no-provision for Solaris 11 guests
|
|
170
|
+
```
|
|
171
|
+
* Merge pull request #1114 from briancain/maint/improve-vmpooler-error-msg (0562c213)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
Merge pull request #1114 from briancain/maint/improve-vmpooler-error-msg
|
|
176
|
+
|
|
177
|
+
(maint) Improve the error message returned when failing to request vms
|
|
178
|
+
```
|
|
179
|
+
* (maint) Include parsed response in error msg (e0f69a5c)
|
|
180
|
+
|
|
181
|
+
* Merge pull request #1109 from kevpl/docs_maintainers_create3 (384384f5)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
Merge pull request #1109 from kevpl/docs_maintainers_create3
|
|
186
|
+
|
|
187
|
+
(MAINT) added maintainers section to README
|
|
188
|
+
```
|
|
189
|
+
* (maint) Improve the error message returned when failing to request vms (c7dc65be)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
(maint) Improve the error message returned when failing to request vms
|
|
194
|
+
|
|
195
|
+
This commit gives a better error message to the user when beaker fails
|
|
196
|
+
to request a host set that doesn't exist in vmpooler.
|
|
197
|
+
```
|
|
198
|
+
* Merge pull request #1110 from er0ck/improve/master/BKR-776-TestCase_methods_for_exporting_structured_data_to_junit_xml (72bff6a5)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Merge pull request #1110 from er0ck/improve/master/BKR-776-TestCase_methods_for_exporting_structured_data_to_junit_xml
|
|
203
|
+
|
|
204
|
+
(BKR-776) test case methods for exporting structured data to junit xml
|
|
205
|
+
```
|
|
206
|
+
* (BKR-789) enable --no-provision for Solaris 11 guests (0c40f30d)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
(BKR-789) enable --no-provision for Solaris 11 guests
|
|
211
|
+
|
|
212
|
+
Without this change, it is not possible to run beaker against solaris
|
|
213
|
+
hosts with --no-provision, which means for every test run the VMs must
|
|
214
|
+
be re-provisioned, which has a big impact on the length of time to be
|
|
215
|
+
able to run tests during development lifecycle.
|
|
216
|
+
|
|
217
|
+
For Solaris the 'rolemod' command is used, but this can only be run
|
|
218
|
+
successfully once, the second time it runs it fails because the root
|
|
219
|
+
user has already been changes from a role to a user. This change adds a
|
|
220
|
+
check to ensure rolemod is only run if it is needed.
|
|
221
|
+
```
|
|
222
|
+
* Merge pull request #1111 from kevpl/bkr787_vmpooler_dont_reask (4f65721d)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Merge pull request #1111 from kevpl/bkr787_vmpooler_dont_reask
|
|
227
|
+
|
|
228
|
+
(BKR-787) vmpooler only asks for failed hosts on provision request repeat
|
|
229
|
+
```
|
|
230
|
+
* (BKR-787) vmpooler only asks for failed hosts on provision request repeat (a1d8e0d5)
|
|
231
|
+
|
|
232
|
+
* Merge pull request #1106 from kevpl/docs_test_suites2 (76349e4d)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
Merge pull request #1106 from kevpl/docs_test_suites2
|
|
237
|
+
|
|
238
|
+
(MAINT) created test_suites.md
|
|
239
|
+
```
|
|
240
|
+
* Merge pull request #1107 from kevpl/docs_ticket_lifecycle_update (cf27df65)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
Merge pull request #1107 from kevpl/docs_ticket_lifecycle_update
|
|
245
|
+
|
|
246
|
+
(MAINT) fixed BKR.next label in JIRA ticket docs
|
|
247
|
+
```
|
|
248
|
+
* (BKR-776) functionality for exporting structured data (to junit xml) (8f3b5327)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
(BKR-776) functionality for exporting structured data (to junit xml)
|
|
253
|
+
|
|
254
|
+
This change adds a dsl method `export` which takes a single argument of
|
|
255
|
+
hash data for export to junit.xml.
|
|
256
|
+
This can be used for later storage without storing all of the logfile.
|
|
257
|
+
Think performance benchmarks, flakiness data, etc.
|
|
258
|
+
```
|
|
259
|
+
* (maint) fix up nearby spec tests (c13c2e14)
|
|
260
|
+
|
|
261
|
+
* (MAINT) added maintainers section to README (620854f1)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
(MAINT) added maintainers section to README
|
|
266
|
+
|
|
267
|
+
[skip ci]
|
|
268
|
+
```
|
|
269
|
+
* (MAINT) created test_suites.md (961dbf47)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
(MAINT) created test_suites.md
|
|
274
|
+
|
|
275
|
+
[skip ci]
|
|
276
|
+
```
|
|
277
|
+
* (maint) update defaults for common user id_rsa-acceptance keys (20fd411b)
|
|
278
|
+
|
|
279
|
+
* (BKR-779) add acceptance tests for skip_test and pending_test (9cfd8d3c)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
(BKR-779) add acceptance tests for skip_test and pending_test
|
|
284
|
+
|
|
285
|
+
These tests required changes to the pre-suite for puppetpkg.
|
|
286
|
+
We might also require changes to puppetgit and puppetgem and maybe pe.
|
|
287
|
+
we need to tell with_puppet_running_on where to find the correct puppet
|
|
288
|
+
service, otherwise beaker defaults to pe-puppetserver.
|
|
289
|
+
```
|
|
290
|
+
* (BKR-779) skip_test, pending_test, fail_test don't work in with_puppet_running_on (2fc36eb3)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
(BKR-779) skip_test, pending_test, fail_test don't work in with_puppet_running_on
|
|
295
|
+
|
|
296
|
+
Prior to this change, these test exits did not work in
|
|
297
|
+
with_puppet_running_on() as the exceptions were not bubbling up to
|
|
298
|
+
TestCase.
|
|
299
|
+
This change rescues the exceptions for these flow-controls before they
|
|
300
|
+
get mangled by the other rescues and sent to TestCase. We should
|
|
301
|
+
probably be using throw here. But there are too many entanglements to
|
|
302
|
+
get them working in this PR.
|
|
303
|
+
```
|
|
304
|
+
* (maint) cleanup some nearby spec tests (7d16c6d0)
|
|
305
|
+
|
|
306
|
+
* Merge pull request #1104 from cmurphy/rpm_upgrade (57ec5a6b)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
Merge pull request #1104 from cmurphy/rpm_upgrade
|
|
311
|
+
|
|
312
|
+
(MAINT) Use the upgrade install option for rpm packages
|
|
313
|
+
```
|
|
314
|
+
* (MAINT) Use the upgrade install option for rpms (2db3708e)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
(MAINT) Use the upgrade install option for rpms
|
|
319
|
+
|
|
320
|
+
Images used in beaker tests might have all kinds of preinstalled
|
|
321
|
+
packages on them, some of which may be out of date. In our case, we
|
|
322
|
+
were preinstalling the puppetlabs el 7.10 release package on images,
|
|
323
|
+
but then running beaker's install_puppet function as a provisional step
|
|
324
|
+
in our tests. Since a new release package was added, this started
|
|
325
|
+
failing[1]. We were able to fix this easily by fixing our images, but
|
|
326
|
+
users depending on externally hosted images, such as vagrant boxes, may
|
|
327
|
+
not be so lucky.
|
|
328
|
+
|
|
329
|
+
This patch changes the -i flag of the rpm install command to -U so that
|
|
330
|
+
the package will be either installed or, if already present but out of
|
|
331
|
+
date, upgraded. This will not change functionality for users with clean
|
|
332
|
+
images who do not need to upgrade anything. The --replacepkgs flag that
|
|
333
|
+
was already present in the rpm command is not sufficient to remove
|
|
334
|
+
conflicting files from older versions of packages.
|
|
335
|
+
|
|
336
|
+
[1] http://logs.openstack.org/77/308277/2/check/gate-openstackci-beaker-centos-7/0736982/console.html#_2016-04-20_14_14_12_690
|
|
337
|
+
```
|
|
338
|
+
* (MAINT) fixed BKR.next label in JIRA ticket docs (c49ae8a4)
|
|
339
|
+
|
|
340
|
+
### <a name = "2.40.0">2.40.0 - 18 Apr, 2016 (0a7b948a)
|
|
341
|
+
|
|
342
|
+
* (HISTORY) update beaker history for gem release 2.40.0 (0a7b948a)
|
|
120
343
|
|
|
121
344
|
* (GEM) update beaker version to 2.40.0 (29b0694d)
|
|
122
345
|
|
data/README.md
CHANGED
|
@@ -23,6 +23,19 @@ Beaker functionality has been extended through the use of libraries available as
|
|
|
23
23
|
|
|
24
24
|
See [LICENSE](LICENSE) file.
|
|
25
25
|
|
|
26
|
-
#Support
|
|
26
|
+
#Support & Issues
|
|
27
27
|
|
|
28
28
|
Please log tickets and issues at our [Beaker Issue Tracker](https://tickets.puppetlabs.com/issues/?jql=project%20%3D%20BKR). In addition there is an active #puppet-dev channel on Freenode.
|
|
29
|
+
|
|
30
|
+
For additional information on filing tickets, please check out our [CONTRIBUTOR doc](CONTRIBUTING.md),
|
|
31
|
+
and for ticket lifecycle information, checkout our [ticket process doc](docs/meta/ticket_process.md).
|
|
32
|
+
|
|
33
|
+
#Maintainers
|
|
34
|
+
|
|
35
|
+
Beaker is maintained by Puppet's Quality Engineering (QE) Team. In particular, our current Beaker maintainers are:
|
|
36
|
+
|
|
37
|
+
| Name | Email |
|
|
38
|
+
|:--------------:|:--------------------:|
|
|
39
|
+
| Kevin Imber | <ki@puppet.com> |
|
|
40
|
+
| Tony Vu | <tony.vu@puppet.com> |
|
|
41
|
+
| Sarah Thompson | <sarah@puppet.com> |
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
+
:type => 'foss',
|
|
3
|
+
:add_el_extras => 'true',
|
|
4
|
+
:is_puppetserver => false,
|
|
5
|
+
:puppetservice => 'puppet.service',
|
|
2
6
|
:pre_suite => 'acceptance/pre_suite/puppet_gem/install.rb',
|
|
3
|
-
:tests => 'acceptance/tests/puppet'
|
|
4
|
-
|
|
7
|
+
:tests => 'acceptance/tests/puppet',
|
|
8
|
+
:'master-start-curl-retries' => 30,
|
|
9
|
+
}.merge(eval File.read('acceptance/config/acceptance-options.rb'))
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
+
:type => 'foss',
|
|
3
|
+
:add_el_extras => 'true',
|
|
4
|
+
:is_puppetserver => false,
|
|
5
|
+
:puppetservice => 'puppet.service',
|
|
2
6
|
:pre_suite => 'acceptance/pre_suite/puppet_git/install.rb',
|
|
3
|
-
:tests => 'acceptance/tests/puppet'
|
|
4
|
-
|
|
7
|
+
:tests => 'acceptance/tests/puppet',
|
|
8
|
+
:'master-start-curl-retries' => 30,
|
|
9
|
+
}.merge(eval File.read('acceptance/config/acceptance-options.rb'))
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
:type => 'foss',
|
|
3
|
+
:is_puppetserver => false,
|
|
4
|
+
:puppetservice => 'puppet.service',
|
|
2
5
|
:pre_suite => 'acceptance/pre_suite/puppet_pkg/install.rb',
|
|
3
|
-
:tests => 'acceptance/tests/puppet'
|
|
4
|
-
|
|
6
|
+
:tests => 'acceptance/tests/puppet',
|
|
7
|
+
:'master-start-curl-retries' => 30,
|
|
8
|
+
}.merge(eval File.read('acceptance/config/acceptance-options.rb'))
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
hosts.each do |host|
|
|
2
2
|
install_puppet_from_gem(host, {:version => '3.7.5'})
|
|
3
|
+
unless host['platform'] =~ /windows/
|
|
4
|
+
on(host, "touch #{File.join(host.puppet['confdir'],'puppet.conf')}")
|
|
5
|
+
on(host, puppet('resource user puppet ensure=present'))
|
|
6
|
+
on(host, puppet('resource group puppet ensure=present'))
|
|
7
|
+
end
|
|
3
8
|
end
|
|
@@ -90,4 +90,9 @@ hosts.each do |host|
|
|
|
90
90
|
repos.each do |repo|
|
|
91
91
|
install_from_git(host, SourcePath, repo)
|
|
92
92
|
end
|
|
93
|
+
unless host['platform'] =~ /windows/
|
|
94
|
+
on(host, "touch #{File.join(host.puppet['confdir'],'puppet.conf')}")
|
|
95
|
+
on(host, puppet('resource user puppet ensure=present'))
|
|
96
|
+
on(host, puppet('resource group puppet ensure=present'))
|
|
97
|
+
end
|
|
93
98
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
test_name 'ensure tests can export arbitrary data' do
|
|
2
|
+
|
|
3
|
+
step 'export nested hash' do
|
|
4
|
+
export({'middle earth' => {
|
|
5
|
+
'Hobbits' => ['Bilbo', 'Frodo'],
|
|
6
|
+
'Elves' => 'Arwen',
|
|
7
|
+
:total => {'numbers' => 42}
|
|
8
|
+
}
|
|
9
|
+
})
|
|
10
|
+
export({'another' => 'author'})
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
test_name 'with_puppet_running_on' do
|
|
2
|
+
|
|
3
|
+
with_puppet_running_on(master, {}) do
|
|
4
|
+
puppet_service = master['puppetservice']
|
|
5
|
+
on(master, puppet("resource service #{puppet_service}")).stdout do |result|
|
|
6
|
+
assert_match(/running/,result,'did not find puppet service/master running')
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
test_name 'skip_test in with_puppet_running_on' do
|
|
13
|
+
|
|
14
|
+
with_puppet_running_on(master, {}) do
|
|
15
|
+
skip_test 'skip rest'
|
|
16
|
+
assert(false)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
test_name 'pending_test in with_puppet_running_on' do
|
|
22
|
+
|
|
23
|
+
with_puppet_running_on(master, {}) do
|
|
24
|
+
pending_test 'pending appendix prepended'
|
|
25
|
+
assert(false)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# TODO: no idea how to test fail_test in here
|
data/docs/Beaker-Libraries.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Beaker Libraries
|
|
2
|
-
|
|
2
|
+
Engineering at Puppet Labs has written several libraries that extends the functionality provided
|
|
3
3
|
by Beaker.
|
|
4
4
|
|
|
5
5
|
| Name | Description | Docs |
|
|
@@ -8,3 +8,9 @@ by Beaker.
|
|
|
8
8
|
| beaker_windows | Useful helpers for testing on Windows hosts | [Github Repo](https://github.com/puppetlabs/beaker_windows) |
|
|
9
9
|
| Puppet Install Helper | Use environment variables for choosing which puppet version to install | [Github Repo](https://github.com/puppetlabs/beaker-puppet_install_helper) |
|
|
10
10
|
| testmode_switcher | [prototype] run your puppet module tests in master/agent, apply or local mode | [Github Repo](https://github.com/puppetlabs/beaker-testmode_switcher) |
|
|
11
|
+
| beaker-hostgenerator | Generates Beaker host files | [Github Repo](https://github.com/puppetlabs/beaker-hostgenerator/) |
|
|
12
|
+
| beaker-answers | Generates answers for Puppet Enterprise installation | [Github Repo](https://github.com/puppetlabs/beaker-answers/) |
|
|
13
|
+
| beaker-pe | Adds helper methods for Puppet Enterprise specific tasks | [Github Repo](https://github.com/puppetlabs/beaker-pe/) |
|
|
14
|
+
| Beaker Rubymine Plugin | An IntelliJ IDEA plugin making Beaker test runs a native IDE experience | [Github Repo](https://github.com/samwoods1/BeakerRubyMinePlugin) |
|
|
15
|
+
| beaker-rspec | A bridge between beaker itself and [rspec](https://github.com/rspec/rspec); also integrates [serverspec](http://serverspec.org/) | [Github Repo](https://github.com/puppetlabs/beaker-rspec/) |
|
|
16
|
+
|
data/docs/meta/ticket_process.md
CHANGED
|
@@ -77,7 +77,7 @@ Once your PR is merged, then you can Resolve your ticket.
|
|
|
77
77
|
|
|
78
78
|
**NOTE** that when you do this, you should set the FixedVersion to
|
|
79
79
|
|
|
80
|
-
BKR
|
|
80
|
+
BKR.next
|
|
81
81
|
|
|
82
82
|
The reason that we do this now and not before is that we use this field to
|
|
83
83
|
autogenerate our release notes. We want to make sure that we capture only
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Test Suites & Failure Modes
|
|
2
|
+
|
|
3
|
+
Beaker test suites correspond to test suites in most testing frameworks,
|
|
4
|
+
being containers for tests or pre- or post-testing files to execute.
|
|
5
|
+
|
|
6
|
+
There are two main ways that you specify which test suites a particular
|
|
7
|
+
file belongs in. The first way is to use the Beaker command line interface
|
|
8
|
+
(CLI) arguments. These are specified in runtime order below:
|
|
9
|
+
|
|
10
|
+
--pre-suite
|
|
11
|
+
—-tests
|
|
12
|
+
—-post-suite
|
|
13
|
+
—-pre-cleanup
|
|
14
|
+
|
|
15
|
+
If you’d like to find out more information about these arguments, or how
|
|
16
|
+
exactly you pass the specified files to each suite, execute `beaker —-help`
|
|
17
|
+
at the CLI.
|
|
18
|
+
|
|
19
|
+
The second way is to provide suite arguments through config files. There
|
|
20
|
+
are two places that you can provide this info:
|
|
21
|
+
|
|
22
|
+
1. The `CONFIG` section of a hosts file.
|
|
23
|
+
2. A local options file passed through the `--options-file` CLI argument.
|
|
24
|
+
|
|
25
|
+
Either way, the keys for the arguments needed are listed below, respective
|
|
26
|
+
to the arguments listed above:
|
|
27
|
+
|
|
28
|
+
:pre_suite
|
|
29
|
+
:tests
|
|
30
|
+
:post_suite
|
|
31
|
+
:pre_cleanup
|
|
32
|
+
|
|
33
|
+
*Note* that one difference between the two methods is that if you provide the
|
|
34
|
+
options via the CLI, we support various input methods such as specifying
|
|
35
|
+
individual files vs paths to folders. The second option (providing keys to
|
|
36
|
+
config files) only works if each file is fully specified. Beaker will not
|
|
37
|
+
find all files in a directory in the second case, that expansion is only done
|
|
38
|
+
on the CLI inputs.
|
|
39
|
+
|
|
40
|
+
# Suite Details, & Failure Mode Behavior
|
|
41
|
+
|
|
42
|
+
This section is to explain the particulars of any suite, and any warnings or
|
|
43
|
+
notes about using them, including how they behave in Beaker’s different
|
|
44
|
+
failure modes.
|
|
45
|
+
|
|
46
|
+
## Pre-Suite
|
|
47
|
+
|
|
48
|
+
The pre-suite is for setting up the Systems Under Test (SUTs) for the testing
|
|
49
|
+
suite. No surprises here, usually these files are filled with the setup and
|
|
50
|
+
installation code needed to verify that the operating assumptions of the
|
|
51
|
+
software being tested are true.
|
|
52
|
+
|
|
53
|
+
Pre-suites, since they’re supposed to contain just setup code, will fail-fast
|
|
54
|
+
and the entire Beaker run will be abandoned if setup fails, since testing
|
|
55
|
+
assumes that setup has succeeded.
|
|
56
|
+
|
|
57
|
+
## Tests
|
|
58
|
+
|
|
59
|
+
Time to actually test! This suite contains the test files that you would
|
|
60
|
+
like to verify new code with.
|
|
61
|
+
|
|
62
|
+
The test suite behaves according to the global fail-mode setting.
|
|
63
|
+
|
|
64
|
+
## Post-Suite
|
|
65
|
+
|
|
66
|
+
Usually the post-suite is used to clean up any fixtures that your tests might
|
|
67
|
+
have poisoned, collect any log files that you’d like to later review, and
|
|
68
|
+
to get any resources from the SUTs before they are cleaned up / deleted.
|
|
69
|
+
|
|
70
|
+
The post-suite only runs if the fail-mode is set to slow, which it is by
|
|
71
|
+
default. Fast fail-mode will skip this suite, so that you can get feedback
|
|
72
|
+
quicker, and you can potentially check out the system in the state exactly
|
|
73
|
+
that it failed in.
|
|
74
|
+
|
|
75
|
+
## Pre-cleanup
|
|
76
|
+
|
|
77
|
+
The pre-cleanup suite is for tasks that you’d like to run at the end of your
|
|
78
|
+
tests, regardless of Beaker’s fail-mode. You can think of this behaving as a
|
|
79
|
+
`finally` block at the end of a `try-rescue` one.
|
|
80
|
+
|
|
81
|
+
The pre-cleanup suite falls back to the global fail-mode setting, which
|
|
82
|
+
defaults to slow, meaning it will run all tests regardless of any early
|
|
83
|
+
failures.
|
|
@@ -16,7 +16,7 @@ module Beaker
|
|
|
16
16
|
# (or range) of integer exit codes that should be considered
|
|
17
17
|
# acceptable. An error will be thrown if the exit code does not
|
|
18
18
|
# match one of the values in this list.
|
|
19
|
-
# @option opts [Boolean] :accept_all_exit_codes (false) Consider all
|
|
19
|
+
# @option opts [Boolean] :accept_all_exit_codes (false) Consider all
|
|
20
20
|
# exit codes as passing.
|
|
21
21
|
# @option opts [Boolean] :dry_run (false) Do not actually execute any
|
|
22
22
|
# commands on the SUT
|
|
@@ -170,6 +170,16 @@ module Beaker
|
|
|
170
170
|
|
|
171
171
|
yield self if block_given?
|
|
172
172
|
|
|
173
|
+
# FIXME: these test-flow-control exceptions should be using throw
|
|
174
|
+
# they can be caught in test_case. current layout dows not allow it
|
|
175
|
+
rescue Beaker::DSL::Outcomes::PassTest => early_assertion
|
|
176
|
+
pass_test(early_assertion)
|
|
177
|
+
rescue Beaker::DSL::Outcomes::FailTest => early_assertion
|
|
178
|
+
fail_test(early_assertion)
|
|
179
|
+
rescue Beaker::DSL::Outcomes::PendingTest => early_assertion
|
|
180
|
+
pending_test(early_assertion)
|
|
181
|
+
rescue Beaker::DSL::Outcomes::SkipTest => early_assertion
|
|
182
|
+
skip_test(early_assertion)
|
|
173
183
|
rescue Beaker::DSL::Assertions, Minitest::Assertion => early_assertion
|
|
174
184
|
fail_test(early_assertion)
|
|
175
185
|
rescue Exception => early_exception
|
data/lib/beaker/dsl/outcomes.rb
CHANGED
|
@@ -77,6 +77,13 @@ module Beaker
|
|
|
77
77
|
raise( SkipTest, message )
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
+
# populate a TestCase's @exports[] with structured_data
|
|
81
|
+
#
|
|
82
|
+
# @param [Hash,Array<Hash>] data The data to export
|
|
83
|
+
def export(data)
|
|
84
|
+
@exports << data
|
|
85
|
+
end
|
|
86
|
+
|
|
80
87
|
# Formats an optional message or self appended by a state, either
|
|
81
88
|
# bracketted in newlines
|
|
82
89
|
#
|
|
@@ -166,7 +166,7 @@ module Unix::Exec
|
|
|
166
166
|
case self['platform']
|
|
167
167
|
when /debian|ubuntu|cumulus|huaweios/
|
|
168
168
|
exec(Beaker::Command.new("service ssh restart"))
|
|
169
|
-
when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7/
|
|
169
|
+
when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7|fedora-(1[4-9]|2[0-9])/
|
|
170
170
|
exec(Beaker::Command.new("systemctl restart sshd.service"))
|
|
171
171
|
when /el-|centos|fedora|redhat|oracle|scientific|eos/
|
|
172
172
|
exec(Beaker::Command.new("/sbin/service sshd restart"))
|
data/lib/beaker/host/unix/pkg.rb
CHANGED
|
@@ -68,7 +68,7 @@ module Unix::Pkg
|
|
|
68
68
|
execute("zypper --non-interactive in #{name}", opts)
|
|
69
69
|
when /el-4/
|
|
70
70
|
@logger.debug("Package installation not supported on rhel4")
|
|
71
|
-
when /fedora-
|
|
71
|
+
when /fedora-(2[2-9])/
|
|
72
72
|
if version
|
|
73
73
|
name = "#{name}-#{version}"
|
|
74
74
|
end
|
|
@@ -139,7 +139,7 @@ module Unix::Pkg
|
|
|
139
139
|
if name =~ /^http/ and opts[:package_proxy]
|
|
140
140
|
proxy = extract_rpm_proxy_options(opts[:package_proxy])
|
|
141
141
|
end
|
|
142
|
-
execute("rpm #{cmdline_args} -
|
|
142
|
+
execute("rpm #{cmdline_args} -Uvh #{name} #{proxy}")
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
def uninstall_package(name, cmdline_args = '', opts = {})
|
|
@@ -176,7 +176,7 @@ module Unix::Pkg
|
|
|
176
176
|
execute("zypper --non-interactive --no-gpg-checks up #{name}", opts)
|
|
177
177
|
when /el-4/
|
|
178
178
|
@logger.debug("Package upgrade is not supported on rhel4")
|
|
179
|
-
when /fedora-
|
|
179
|
+
when /fedora-(2[2-9])/
|
|
180
180
|
execute("dnf -y #{cmdline_args} update #{name}", opts)
|
|
181
181
|
when /cisco|fedora|centos|eos|el-/
|
|
182
182
|
execute("yum -y #{cmdline_args} update #{name}", opts)
|
|
@@ -448,7 +448,7 @@ module Unix::Pkg
|
|
|
448
448
|
)
|
|
449
449
|
variant, version, arch, codename = self['platform'].to_array
|
|
450
450
|
case variant
|
|
451
|
-
when /^(fedora-
|
|
451
|
+
when /^(fedora-(2[2-9]))$/
|
|
452
452
|
execute("tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}")
|
|
453
453
|
execute("dnf --nogpgcheck localinstall -y #{onhost_copied_file}")
|
|
454
454
|
when /^(fedora|el|centos)$/
|
|
@@ -387,7 +387,7 @@ module Beaker
|
|
|
387
387
|
logger.notify "Disabling updates.puppetlabs.com by modifying hosts file to resolve updates to 127.0.0.1 on #{host}"
|
|
388
388
|
set_etc_hosts(host, "127.0.0.1\tupdates.puppetlabs.com\n")
|
|
389
389
|
end
|
|
390
|
-
end
|
|
390
|
+
end
|
|
391
391
|
|
|
392
392
|
# Update sshd_config on debian, ubuntu, centos, el, redhat, cumulus, and fedora boxes to allow for root login
|
|
393
393
|
#
|
|
@@ -410,7 +410,7 @@ module Beaker
|
|
|
410
410
|
elsif host['platform'] =~ /solaris-10/
|
|
411
411
|
host.exec(Command.new("sudo gsed -i -e 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config"), {:pty => true} )
|
|
412
412
|
elsif host['platform'] =~ /solaris-11/
|
|
413
|
-
host.exec(Command.new("sudo rolemod -K type=normal root"), {:pty => true} )
|
|
413
|
+
host.exec(Command.new("if grep \"root::::type=role\" /etc/user_attr; then sudo rolemod -K type=normal root; else echo \"root user already type=normal\"; fi"), {:pty => true} )
|
|
414
414
|
host.exec(Command.new("sudo gsed -i -e 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config"), {:pty => true} )
|
|
415
415
|
elsif not host.is_powershell?
|
|
416
416
|
host.exec(Command.new("sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\""), {:pty => true})
|
|
@@ -420,7 +420,7 @@ module Beaker
|
|
|
420
420
|
#restart sshd
|
|
421
421
|
if host['platform'] =~ /debian|ubuntu|cumulus/
|
|
422
422
|
host.exec(Command.new("sudo su -c \"service ssh restart\""), {:pty => true})
|
|
423
|
-
elsif host['platform'] =~ /centos-7|el-7|redhat-7/
|
|
423
|
+
elsif host['platform'] =~ /centos-7|el-7|redhat-7|fedora-(1[4-9]|2[0-9])/
|
|
424
424
|
host.exec(Command.new("sudo -E systemctl restart sshd.service"), {:pty => true})
|
|
425
425
|
elsif host['platform'] =~ /centos|el-|redhat|fedora|eos/
|
|
426
426
|
host.exec(Command.new("sudo -E /sbin/service sshd reload"), {:pty => true})
|
|
@@ -212,7 +212,7 @@ module Beaker
|
|
|
212
212
|
RUN apt-get update
|
|
213
213
|
RUN apt-get install -y openssh-server openssh-client #{Beaker::HostPrebuiltSteps::CUMULUS_PACKAGES.join(' ')}
|
|
214
214
|
EOF
|
|
215
|
-
when /fedora-
|
|
215
|
+
when /fedora-(2[2-9])/
|
|
216
216
|
dockerfile += <<-EOF
|
|
217
217
|
RUN dnf clean all
|
|
218
218
|
RUN dnf install -y sudo openssh-server openssh-clients #{Beaker::HostPrebuiltSteps::UNIX_PACKAGES.join(' ')}
|
|
@@ -126,31 +126,41 @@ module Beaker
|
|
|
126
126
|
@logger.notify "Requesting VM set from vmpooler"
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
request_payload_json = request_payload.to_json
|
|
130
|
+
@logger.trace( "Request payload json: #{request_payload_json}" )
|
|
131
|
+
request.body = request_payload_json
|
|
130
132
|
|
|
131
133
|
response = http.request(request)
|
|
132
134
|
parsed_response = JSON.parse(response.body)
|
|
135
|
+
@logger.trace( "Response parsed json: #{parsed_response}" )
|
|
133
136
|
|
|
134
137
|
if parsed_response['ok']
|
|
135
138
|
domain = parsed_response['domain']
|
|
139
|
+
request_payload = {}
|
|
136
140
|
|
|
137
141
|
@hosts.each_with_index do |h, i|
|
|
138
142
|
# If the requested host template is not available on vmpooler
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
host_template = h['template']
|
|
144
|
+
if get_host_info(parsed_response, host_template).nil?
|
|
145
|
+
request_payload[host_template] ||= 0
|
|
146
|
+
request_payload[host_template] += 1
|
|
147
|
+
next
|
|
141
148
|
end
|
|
142
149
|
if parsed_response[h['template']]['hostname'].is_a?(Array)
|
|
143
|
-
hostname = parsed_response[
|
|
150
|
+
hostname = parsed_response[host_template]['hostname'].shift
|
|
144
151
|
else
|
|
145
|
-
hostname = parsed_response[
|
|
152
|
+
hostname = parsed_response[host_template]['hostname']
|
|
146
153
|
end
|
|
147
154
|
|
|
148
155
|
h['vmhostname'] = domain ? "#{hostname}.#{domain}" : hostname
|
|
149
156
|
|
|
150
157
|
@logger.notify "Using available host '#{h['vmhostname']}' (#{h.name})"
|
|
151
158
|
end
|
|
159
|
+
unless request_payload.empty?
|
|
160
|
+
raise "Vmpooler.provision - requested VM templates #{request_payload.keys} not available"
|
|
161
|
+
end
|
|
152
162
|
else
|
|
153
|
-
raise "Vmpooler.provision -
|
|
163
|
+
raise "Vmpooler.provision - response from pooler not ok. Requested host set #{request_payload.keys} not available in pooler.\n#{parsed_response}"
|
|
154
164
|
end
|
|
155
165
|
rescue JSON::ParserError, RuntimeError, *SSH_EXCEPTIONS => e
|
|
156
166
|
@logger.debug "Failed vmpooler provision: #{e.class} : #{e.message}"
|
data/lib/beaker/test_case.rb
CHANGED
|
@@ -37,6 +37,10 @@ module Beaker
|
|
|
37
37
|
# a hash.
|
|
38
38
|
attr_accessor :metadata
|
|
39
39
|
|
|
40
|
+
# Necessary for {Beaker::DSL::Outcomes}.
|
|
41
|
+
# Assumed to be an Array.
|
|
42
|
+
attr_accessor :exports
|
|
43
|
+
|
|
40
44
|
#The full log for this test
|
|
41
45
|
attr_accessor :sublog
|
|
42
46
|
|
|
@@ -102,6 +106,7 @@ module Beaker
|
|
|
102
106
|
@runtime = nil
|
|
103
107
|
@teardown_procs = []
|
|
104
108
|
@metadata = {}
|
|
109
|
+
@exports = []
|
|
105
110
|
set_current_test_filename(@path ? File.basename(@path, '.rb') : nil)
|
|
106
111
|
|
|
107
112
|
|
data/lib/beaker/test_suite.rb
CHANGED
|
@@ -203,6 +203,13 @@ module Beaker
|
|
|
203
203
|
item['name'] = File.basename(test.path)
|
|
204
204
|
item['time'] = "%f" % test.runtime
|
|
205
205
|
|
|
206
|
+
#ugh. nokogiri!!! item can't take a hash, let alone an array.
|
|
207
|
+
test.exports.each do |export|
|
|
208
|
+
export.keys.each do |key|
|
|
209
|
+
item[key] = export[key]
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
206
213
|
# Did we fail? If so, report that.
|
|
207
214
|
# We need to remove the escape character from colorized text, the
|
|
208
215
|
# substitution of other entities is handled well by Rexml
|
data/lib/beaker/version.rb
CHANGED
|
@@ -5,6 +5,7 @@ class ClassMixedWithDSLHelpers
|
|
|
5
5
|
include Beaker::DSL::Wrappers
|
|
6
6
|
include Beaker::DSL::Roles
|
|
7
7
|
include Beaker::DSL::Patterns
|
|
8
|
+
include Beaker::DSL::Outcomes
|
|
8
9
|
|
|
9
10
|
def logger
|
|
10
11
|
RSpec::Mocks::Double.new('logger').as_null_object
|
|
@@ -502,6 +503,33 @@ describe ClassMixedWithDSLHelpers do
|
|
|
502
503
|
subject.with_puppet_running_on(host, {})
|
|
503
504
|
end
|
|
504
505
|
|
|
506
|
+
context 'with test flow exceptions' do
|
|
507
|
+
it 'can pass_test' do
|
|
508
|
+
expect( subject ).to receive(:backup_the_file).and_raise(Beaker::DSL::Outcomes::PassTest)
|
|
509
|
+
expect {
|
|
510
|
+
subject.with_puppet_running_on(host, {}).to receive(:pass_test)
|
|
511
|
+
}.to raise_error(Beaker::DSL::Outcomes::PassTest)
|
|
512
|
+
end
|
|
513
|
+
it 'can fail_test' do
|
|
514
|
+
expect( subject ).to receive(:backup_the_file).and_raise(Beaker::DSL::Outcomes::FailTest)
|
|
515
|
+
expect {
|
|
516
|
+
subject.with_puppet_running_on(host, {}).to receive(:fail_test)
|
|
517
|
+
}.to raise_error(Beaker::DSL::Outcomes::FailTest)
|
|
518
|
+
end
|
|
519
|
+
it 'can skip_test' do
|
|
520
|
+
expect( subject ).to receive(:backup_the_file).and_raise(Beaker::DSL::Outcomes::SkipTest)
|
|
521
|
+
expect {
|
|
522
|
+
subject.with_puppet_running_on(host, {}).to receive(:skip_test)
|
|
523
|
+
}.to raise_error(Beaker::DSL::Outcomes::SkipTest)
|
|
524
|
+
end
|
|
525
|
+
it 'can pending_test' do
|
|
526
|
+
expect( subject ).to receive(:backup_the_file).and_raise(Beaker::DSL::Outcomes::PendingTest)
|
|
527
|
+
expect {
|
|
528
|
+
subject.with_puppet_running_on(host, {}).to receive(:pending_test)
|
|
529
|
+
}.to raise_error(Beaker::DSL::Outcomes::PendingTest)
|
|
530
|
+
end
|
|
531
|
+
end
|
|
532
|
+
|
|
505
533
|
describe 'with puppet-server' do
|
|
506
534
|
let(:default_confdir) { "/etc/puppet" }
|
|
507
535
|
let(:default_vardir) { "/var/lib/puppet" }
|
|
@@ -842,17 +870,16 @@ describe ClassMixedWithDSLHelpers do
|
|
|
842
870
|
end
|
|
843
871
|
end
|
|
844
872
|
|
|
873
|
+
let(:logger) { double.as_null_object }
|
|
845
874
|
describe 'handling failures' do
|
|
846
875
|
|
|
847
|
-
let(:logger) { double.as_null_object }
|
|
848
876
|
before do
|
|
849
877
|
allow( subject ).to receive( :logger ).and_return( logger )
|
|
850
878
|
expect( subject ).to receive(:stop_puppet_from_source_on).and_raise(RuntimeError.new('Also failed in teardown.'))
|
|
879
|
+
expect( host ).to receive(:port_open?).with(8140).and_return(true)
|
|
851
880
|
end
|
|
852
881
|
|
|
853
882
|
it 'does not swallow an exception raised from within test block if ensure block also fails' do
|
|
854
|
-
expect( host ).to receive(:port_open?).with(8140).and_return(true)
|
|
855
|
-
|
|
856
883
|
expect( subject.logger ).to receive(:error).with(/Raised during attempt to teardown.*Also failed in teardown/)
|
|
857
884
|
|
|
858
885
|
expect do
|
|
@@ -861,8 +888,6 @@ describe ClassMixedWithDSLHelpers do
|
|
|
861
888
|
end
|
|
862
889
|
|
|
863
890
|
it 'dumps the puppet logs if there is an error in the teardown' do
|
|
864
|
-
expect( host ).to receive(:port_open?).with(8140).and_return(true)
|
|
865
|
-
|
|
866
891
|
expect( subject.logger ).to receive(:notify).with(/Dumping master log/)
|
|
867
892
|
|
|
868
893
|
expect do
|
|
@@ -871,8 +896,6 @@ describe ClassMixedWithDSLHelpers do
|
|
|
871
896
|
end
|
|
872
897
|
|
|
873
898
|
it 'does not mask the teardown error with an error from dumping the logs' do
|
|
874
|
-
expect( host ).to receive(:port_open?).with(8140).and_return(true)
|
|
875
|
-
|
|
876
899
|
expect( subject.logger ).to receive(:notify).with(/Dumping master log/).and_raise("Error from dumping logs")
|
|
877
900
|
|
|
878
901
|
expect do
|
|
@@ -881,13 +904,14 @@ describe ClassMixedWithDSLHelpers do
|
|
|
881
904
|
end
|
|
882
905
|
|
|
883
906
|
it 'does not swallow a teardown exception if no earlier exception was raised' do
|
|
884
|
-
expect( host ).to receive(:port_open?).with(8140).and_return(true)
|
|
885
907
|
expect( subject.logger).to_not receive(:error)
|
|
886
908
|
expect do
|
|
887
909
|
subject.with_puppet_running_on(host, {})
|
|
888
910
|
end.to raise_error(RuntimeError, 'Also failed in teardown.')
|
|
889
911
|
end
|
|
912
|
+
|
|
890
913
|
end
|
|
914
|
+
|
|
891
915
|
end
|
|
892
916
|
end
|
|
893
917
|
|
|
@@ -214,20 +214,24 @@ module Beaker
|
|
|
214
214
|
end
|
|
215
215
|
end
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
217
|
+
(1..21).to_a.each do | fedora_release |
|
|
218
|
+
it "uses yum on fedora-#{fedora_release}" do
|
|
219
|
+
@opts = {'platform' => "fedora-#{fedora_release}-is-me"}
|
|
220
|
+
pkg = 'fedora_package'
|
|
221
|
+
expect( Beaker::Command ).to receive(:new).with("yum -y install #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
|
|
222
|
+
expect( instance ).to receive(:exec).with('', {}).and_return(generate_result("hello", {:exit_code => 0}))
|
|
223
|
+
expect( instance.install_package(pkg) ).to be == "hello"
|
|
224
|
+
end
|
|
223
225
|
end
|
|
224
226
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
(22..29).to_a.each do | fedora_release |
|
|
228
|
+
it "uses dnf on fedora-#{fedora_release}" do
|
|
229
|
+
@opts = {'platform' => "fedora-#{fedora_release}-is-me"}
|
|
230
|
+
pkg = 'fedora_package'
|
|
231
|
+
expect( Beaker::Command ).to receive(:new).with("dnf -y install #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
|
|
232
|
+
expect( instance ).to receive(:exec).with('', {}).and_return(generate_result("hello", {:exit_code => 0}))
|
|
233
|
+
expect( instance.install_package(pkg) ).to be == "hello"
|
|
234
|
+
end
|
|
231
235
|
end
|
|
232
236
|
end
|
|
233
237
|
|
|
@@ -257,7 +261,7 @@ module Beaker
|
|
|
257
261
|
it "accepts a package as a single argument" do
|
|
258
262
|
@opts = {'platform' => 'el-is-me'}
|
|
259
263
|
pkg = 'redhat_package'
|
|
260
|
-
expect( Beaker::Command ).to receive(:new).with("rpm -
|
|
264
|
+
expect( Beaker::Command ).to receive(:new).with("rpm -Uvh #{pkg} ", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
|
|
261
265
|
expect( instance ).to receive(:exec).with('', {}).and_return(generate_result("hello", {:exit_code => 0}))
|
|
262
266
|
expect( instance.install_package_with_rpm(pkg) ).to be == "hello"
|
|
263
267
|
end
|
|
@@ -266,7 +270,7 @@ module Beaker
|
|
|
266
270
|
@opts = {'platform' => 'el-is-me'}
|
|
267
271
|
pkg = 'redhat_package'
|
|
268
272
|
cmdline_args = '--foo'
|
|
269
|
-
expect( Beaker::Command ).to receive(:new).with("rpm #{cmdline_args} -
|
|
273
|
+
expect( Beaker::Command ).to receive(:new).with("rpm #{cmdline_args} -Uvh #{pkg} ", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('')
|
|
270
274
|
expect( instance ).to receive(:exec).with('', {}).and_return(generate_result("hello", {:exit_code => 0}))
|
|
271
275
|
expect( instance.install_package_with_rpm(pkg, cmdline_args) ).to be == "hello"
|
|
272
276
|
end
|
|
@@ -56,6 +56,18 @@ describe Beaker do
|
|
|
56
56
|
"sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /etc/sshd_config"
|
|
57
57
|
]
|
|
58
58
|
|
|
59
|
+
# Solaris
|
|
60
|
+
it_should_behave_like 'enables_root_login', 'solaris-10', [
|
|
61
|
+
"sudo -E svcadm restart network/ssh",
|
|
62
|
+
"sudo gsed -i -e 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config"
|
|
63
|
+
], true
|
|
64
|
+
|
|
65
|
+
it_should_behave_like 'enables_root_login', 'solaris-11', [
|
|
66
|
+
"sudo -E svcadm restart network/ssh",
|
|
67
|
+
"sudo gsed -i -e 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config",
|
|
68
|
+
"if grep \"root::::type=role\" /etc/user_attr; then sudo rolemod -K type=normal root; else echo \"root user already type=normal\"; fi"
|
|
69
|
+
], true
|
|
70
|
+
|
|
59
71
|
['debian','ubuntu','cumulus'].each do | deb_like |
|
|
60
72
|
it_should_behave_like 'enables_root_login', deb_like, [
|
|
61
73
|
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
|
|
@@ -11,10 +11,10 @@ end
|
|
|
11
11
|
|
|
12
12
|
module Beaker
|
|
13
13
|
platforms = [
|
|
14
|
-
"ubuntu-14.04-x86_64",
|
|
15
|
-
"cumulus-2.2-x86_64",
|
|
16
|
-
"fedora-22-x86_64",
|
|
17
|
-
"centos-7-x86_64",
|
|
14
|
+
"ubuntu-14.04-x86_64",
|
|
15
|
+
"cumulus-2.2-x86_64",
|
|
16
|
+
"fedora-22-x86_64",
|
|
17
|
+
"centos-7-x86_64",
|
|
18
18
|
"sles-12-x86_64"
|
|
19
19
|
]
|
|
20
20
|
|
|
@@ -427,14 +427,16 @@ module Beaker
|
|
|
427
427
|
expect( dockerfile ).to be =~ /RUN zypper -n in openssh/
|
|
428
428
|
end
|
|
429
429
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
430
|
+
(22..29).to_a.each do | fedora_release |
|
|
431
|
+
it "should use dnf on fedora #{fedora_release}" do
|
|
432
|
+
FakeFS.deactivate!
|
|
433
|
+
dockerfile = docker.send(:dockerfile_for, {
|
|
434
|
+
'platform' => "fedora-#{fedora_release}-x86_64",
|
|
435
|
+
'image' => 'foobar',
|
|
436
|
+
})
|
|
436
437
|
|
|
437
|
-
|
|
438
|
+
expect( dockerfile ).to be =~ /RUN dnf install -y sudo/
|
|
439
|
+
end
|
|
438
440
|
end
|
|
439
441
|
|
|
440
442
|
it 'should use user dockerfile if specified' do
|
|
@@ -76,13 +76,35 @@ module Beaker
|
|
|
76
76
|
|
|
77
77
|
it 'raises an error when a host template is not found in returned json' do
|
|
78
78
|
vmpooler = Beaker::Vmpooler.new( make_hosts, make_opts )
|
|
79
|
-
host = vmpooler.instance_variable_get(:@hosts)[0][:template]
|
|
80
79
|
|
|
81
80
|
allow( vmpooler ).to receive( :require ).and_return( true )
|
|
82
81
|
allow( vmpooler ).to receive( :sleep ).and_return( true )
|
|
83
|
-
allow( vmpooler ).to receive(:get_host_info).and_return(nil)
|
|
82
|
+
allow( vmpooler ).to receive( :get_host_info ).and_return( nil )
|
|
84
83
|
|
|
85
|
-
expect {
|
|
84
|
+
expect {
|
|
85
|
+
vmpooler.provision
|
|
86
|
+
}.to raise_error( RuntimeError,
|
|
87
|
+
/Vmpooler\.provision - requested VM templates \[.*\,.*\,.*\] not available/
|
|
88
|
+
)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'repeats asking only for failed hosts' do
|
|
92
|
+
vmpooler = Beaker::Vmpooler.new( make_hosts, make_opts )
|
|
93
|
+
|
|
94
|
+
allow( vmpooler ).to receive( :require ).and_return( true )
|
|
95
|
+
allow( vmpooler ).to receive( :sleep ).and_return( true )
|
|
96
|
+
allow( vmpooler ).to receive( :get_host_info ).with(
|
|
97
|
+
anything, "vm1_has_a_template" ).and_return( nil )
|
|
98
|
+
allow( vmpooler ).to receive( :get_host_info ).with(
|
|
99
|
+
anything, "vm2_has_a_template" ).and_return( 'y' )
|
|
100
|
+
allow( vmpooler ).to receive( :get_host_info ).with(
|
|
101
|
+
anything, "vm3_has_a_template" ).and_return( 'y' )
|
|
102
|
+
|
|
103
|
+
expect {
|
|
104
|
+
vmpooler.provision
|
|
105
|
+
}.to raise_error( RuntimeError,
|
|
106
|
+
/Vmpooler\.provision - requested VM templates \[[^\,]*\] not available/
|
|
107
|
+
) # should be only one item in the list, no commas
|
|
86
108
|
end
|
|
87
109
|
end
|
|
88
110
|
|
|
@@ -227,40 +227,86 @@ module Beaker
|
|
|
227
227
|
end
|
|
228
228
|
|
|
229
229
|
describe '#write_junit_xml' do
|
|
230
|
-
let(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
allow(
|
|
238
|
-
|
|
230
|
+
let(:options) { make_opts.merge({:logger => double().as_null_object,
|
|
231
|
+
'name' => create_files(@files),
|
|
232
|
+
:log_dated_dir => '.',
|
|
233
|
+
:xml_dated_dir => '.'}) }
|
|
234
|
+
let(:rb_test) { 'my_ruby_file.rb' }
|
|
235
|
+
before(:each) do
|
|
236
|
+
@nokogiri_mock = Hash.new
|
|
237
|
+
allow( @nokogiri_mock ).to receive( :add_child )
|
|
238
|
+
allow( Nokogiri::XML::Node ).to receive( :new ) { @nokogiri_mock }
|
|
239
|
+
allow( LoggerJunit ).to receive( :write_xml ).and_yield( Object.new, @nokogiri_mock )
|
|
239
240
|
@files = [ rb_test, rb_test, rb_test]
|
|
240
|
-
ts
|
|
241
|
-
tsr
|
|
242
|
-
|
|
243
|
-
allow( tsr ).to receive( :
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
test_cases = []
|
|
248
|
-
3.times do
|
|
241
|
+
@ts = Beaker::TestSuite.new( 'name', hosts, options, Time.now, :fast )
|
|
242
|
+
@tsr = @ts.instance_variable_get( :@test_suite_results )
|
|
243
|
+
allow( @tsr ).to receive( :start_time ).and_return(0)
|
|
244
|
+
allow( @tsr ).to receive( :stop_time ).and_return(10)
|
|
245
|
+
@test_cases = []
|
|
246
|
+
@files.each_with_index do |file, index|
|
|
249
247
|
tc = Beaker::TestCase.new( hosts, options[:logger], options, rb_test)
|
|
250
248
|
allow( tc ).to receive( :sublog ).and_return( false )
|
|
251
|
-
test_cases << tc
|
|
249
|
+
@test_cases << tc
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
it 'doesn\'t re-order test cases themselves on time_sort' do
|
|
254
|
+
expect( @tsr.instance_variable_get( :@logger ) ).to receive( :error ).never
|
|
255
|
+
|
|
256
|
+
@test_cases.each_with_index do |tc,index|
|
|
257
|
+
tc.instance_variable_set(:@runtime, 3**index)
|
|
258
|
+
@tsr.add_test_case( tc )
|
|
252
259
|
end
|
|
253
|
-
test_cases[0].instance_variable_set(:@runtime, 3)
|
|
254
|
-
test_cases[1].instance_variable_set(:@runtime, 301)
|
|
255
|
-
test_cases[2].instance_variable_set(:@runtime, 101)
|
|
256
|
-
test_cases.map { |tc| tsr.add_test_case( tc ) }
|
|
257
260
|
|
|
258
261
|
original_testcase_order = test_suite_result.instance_variable_get( :@test_cases ).dup
|
|
259
|
-
|
|
262
|
+
time_sort = true
|
|
263
|
+
@tsr.write_junit_xml( 'fakeFilePath07', 'fakeFileToLink09', time_sort )
|
|
260
264
|
after_testcase_order = test_suite_result.instance_variable_get( :@test_cases ).dup
|
|
261
265
|
expect( after_testcase_order ).to be === original_testcase_order
|
|
262
266
|
end
|
|
263
267
|
|
|
268
|
+
it 'writes @export nested hashes properly' do
|
|
269
|
+
expect( @tsr.instance_variable_get( :@logger ) ).to receive( :error ).never
|
|
270
|
+
inner_value = {'second' => '2nd'}
|
|
271
|
+
@test_cases.each do |tc|
|
|
272
|
+
tc.instance_variable_set(:@runtime, 0)
|
|
273
|
+
tc.instance_variable_set(:@exports, [{'oh' => 'hai', 'first' => inner_value}])
|
|
274
|
+
@tsr.add_test_case( tc )
|
|
275
|
+
end
|
|
276
|
+
@tsr.write_junit_xml( 'fakeFilePath08' )
|
|
277
|
+
expect( @nokogiri_mock['oh'] ).to eq('hai')
|
|
278
|
+
expect( @nokogiri_mock['first'] ).to eq(inner_value)
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
it 'writes @export array of hashes properly' do
|
|
282
|
+
expect( @tsr.instance_variable_get( :@logger ) ).to receive( :error ).never
|
|
283
|
+
@test_cases.each do |tc|
|
|
284
|
+
tc.instance_variable_set(:@runtime, 0)
|
|
285
|
+
tc.instance_variable_set(:@exports, [{:yes => 'hello'}, {:uh => 'sher'}])
|
|
286
|
+
@tsr.add_test_case( tc )
|
|
287
|
+
end
|
|
288
|
+
@tsr.write_junit_xml( 'fakeFilePath08' )
|
|
289
|
+
expect( @nokogiri_mock[:yes] ).to eq('hello')
|
|
290
|
+
expect( @nokogiri_mock[:uh] ).to eq('sher')
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# this isn't the best test as the @nokogiri_mock is a single hash.
|
|
294
|
+
# it really should be an array of hashes or nested, to ensure each case
|
|
295
|
+
# gets the correct key/value. But i could not get it to work properly with
|
|
296
|
+
# the various calls to ::Node and #add_child
|
|
297
|
+
it 'writes @export hashes per test case properly' do
|
|
298
|
+
expect( @tsr.instance_variable_get( :@logger ) ).to receive( :error ).never
|
|
299
|
+
@test_cases.each_with_index do |tc,index|
|
|
300
|
+
tc.instance_variable_set(:@runtime, 0)
|
|
301
|
+
tc.instance_variable_set(:@exports, [{"yes_#{index}" => "hello#{index}"}])
|
|
302
|
+
@tsr.add_test_case( tc )
|
|
303
|
+
end
|
|
304
|
+
@tsr.write_junit_xml( 'fakeFilePath08' )
|
|
305
|
+
@test_cases.each_with_index do |tc,index|
|
|
306
|
+
expect( @nokogiri_mock["yes_#{index}"] ).to eq("hello#{index}")
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
264
310
|
end
|
|
265
311
|
|
|
266
312
|
|
data/spec/helpers.rb
CHANGED
|
@@ -119,12 +119,17 @@ module PlatformHelpers
|
|
|
119
119
|
'cumulus',
|
|
120
120
|
'huaweios']
|
|
121
121
|
|
|
122
|
+
|
|
123
|
+
FEDORASYSTEMD = (14..29).to_a.collect! { |i| "fedora-#{i}" }
|
|
124
|
+
|
|
122
125
|
SYSTEMDPLATFORMS = ['el-7',
|
|
123
126
|
'centos-7',
|
|
124
127
|
'redhat-7',
|
|
125
128
|
'oracle-7',
|
|
126
129
|
'scientific-7',
|
|
127
|
-
'eos-7']
|
|
130
|
+
'eos-7'].concat(FEDORASYSTEMD)
|
|
131
|
+
|
|
132
|
+
FEDORASYSTEMV = (1..13).to_a.collect! { |i| "fedora-#{i}" }
|
|
128
133
|
|
|
129
134
|
SYSTEMVPLATFORMS = ['el-',
|
|
130
135
|
'centos',
|
|
@@ -132,5 +137,5 @@ module PlatformHelpers
|
|
|
132
137
|
'redhat',
|
|
133
138
|
'oracle',
|
|
134
139
|
'scientific',
|
|
135
|
-
'eos']
|
|
140
|
+
'eos'].concat(FEDORASYSTEMV)
|
|
136
141
|
end
|
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: 2.
|
|
4
|
+
version: 2.41.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Puppetlabs
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -567,10 +567,12 @@ files:
|
|
|
567
567
|
- acceptance/tests/base/host_test.rb
|
|
568
568
|
- acceptance/tests/base/packages.rb
|
|
569
569
|
- acceptance/tests/base/packages_unix.rb
|
|
570
|
+
- acceptance/tests/base/test_suite/export.rb
|
|
570
571
|
- acceptance/tests/hypervisor/communication_test.rb
|
|
571
572
|
- acceptance/tests/load_path_bootstrap.rb
|
|
572
573
|
- acceptance/tests/puppet/README.md
|
|
573
574
|
- acceptance/tests/puppet/install_smoke_test.rb
|
|
575
|
+
- acceptance/tests/puppet/with_puppet_running_on.rb
|
|
574
576
|
- beaker.gemspec
|
|
575
577
|
- bin/beaker
|
|
576
578
|
- docs/Access-the-Live-Test-Console-with-Pry.md
|
|
@@ -612,6 +614,7 @@ files:
|
|
|
612
614
|
- docs/hypervisors/vagrant.md
|
|
613
615
|
- docs/meta/README.md
|
|
614
616
|
- docs/meta/ticket_process.md
|
|
617
|
+
- docs/runner/test_suites.md
|
|
615
618
|
- docs/vSphere-Support.md
|
|
616
619
|
- ext/completion/beaker-completion.bash
|
|
617
620
|
- lib/beaker.rb
|