beaker-rspec 6.1.0 → 6.2.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/README.md +29 -23
- data/lib/beaker-rspec/spec_helper.rb +6 -4
- data/lib/beaker-rspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTA2OGVlNGU3YWNkNWMzNjc0YzkxMTVhMjU3N2E5OTJiODQ0ZTgyNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODMyY2Q5NGI3YTA1YjgwNzdiYzRhODdkOWNmNjRkOTNhYjk2YzAyNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2ViNmU1NThkNDUyZGQwMDg2MjZjMTUwNzVhOGI5NTM1MTc1YWRlMTNlZDJm
|
10
|
+
Y2QzNzQ3OWQyZjliY2RhOTczYzE1Y2U2MzM2NDI2ZTAxMmQ0MmQ5MjM5ZGVh
|
11
|
+
YmFkYjljY2JhNzMxMzZiMmM0MzI3ZTFlYjYzOTVmNGNjYTEzMzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzAwZDJiMmQ1ZGFhZWFlZTFmMjZiNGIyMjRhYzk4NzNjZjUxN2YwZWUyYjBm
|
14
|
+
ZmQ3NzUwYjk4MzQ5YjJlOTJmMmY1YjllY2YyNzJjYzQyY2JjMThmOWY4NzY3
|
15
|
+
OWZlYzFiNGRmMGY4MGQ0OTIwYjQ1ZjA3MDg3NjYzNDMwNjI3MDg=
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#beaker-rspec
|
1
|
+
# beaker-rspec
|
2
2
|
|
3
3
|
beaker-rspec is a bridge between the puppet acceptance test harness ([beaker](https://github.com/puppetlabs/beaker)) and [rspec](https://github.com/rspec/rspec). It also integrates [serverspec](http://serverspec.org/).
|
4
4
|
|
5
|
-
#Upgrading from beaker-rspec 5 to 6
|
5
|
+
# Upgrading from beaker-rspec 5 to 6
|
6
6
|
|
7
7
|
In beaker-rspec 6, we've picked up the newest beaker, 3.y. In this release, we've
|
8
8
|
given up support for Ruby 1.9 and moved to 2.2.5 as our lowest tested version,
|
@@ -13,46 +13,50 @@ To learn more about those changes, please checkout our
|
|
13
13
|
doc. Note that besides the Ruby version & beaker dependency change, nothing else
|
14
14
|
was changed in beaker-rspec itself.
|
15
15
|
|
16
|
-
#Typical Workflow
|
16
|
+
# Typical Workflow
|
17
17
|
|
18
18
|
Beaker does setup and provision all nodes from your nodeset on each test run, and cleans up the VMs after use. During development on a module it can be very handy to keep the VMs available for inspection or reuse. Set `BEAKER_destroy=no` do skip the cleanup and `BEAKER_provision=no` once the VMs are created.
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
* Run tests with `BEAKER_destroy=no`, no setting for `BEAKER_provision`
|
21
|
+
* beaker-rspec will use spec/acceptance/nodesets/default.yml node file
|
22
|
+
* boxes will be newly provisioned
|
23
|
+
* boxes will be preserved post-testing
|
24
|
+
|
24
25
|
* Run tests with `BEAKER_destroy=no` and `BEAKER_provision=no`
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
* Nodes become corrupted with too many test runs/bad data and need to be refreshed then set `BEAKER_provision=yes`
|
29
|
-
* Testing is complete and you want to clean up, run once more with `BEAKER_destroy` unset
|
30
|
-
|
26
|
+
* beaker-rspec will use spec/acceptance/nodesets/default.yml node file
|
27
|
+
* boxes will be re-used from previous run
|
28
|
+
* boxes will be preserved post-testing
|
29
|
+
* Nodes become corrupted with too many test runs/bad data and need to be refreshed then set `BEAKER_provision=yes`
|
30
|
+
* Testing is complete and you want to clean up, run once more with `BEAKER_destroy` unset
|
31
|
+
* you can also:
|
31
32
|
|
32
|
-
|
33
|
+
```
|
34
|
+
cd .vagrant/beaker_vagrant_files/default.yml ; vagrant destroy --force
|
35
|
+
```
|
33
36
|
|
34
|
-
##Supported ENV variables
|
37
|
+
## Supported ENV variables
|
35
38
|
|
36
39
|
* `BEAKER_color`: set to `no` to disable color output
|
37
40
|
* `BEAKER_debug`: set to any value to enable beaker debug logging
|
38
41
|
* `BEAKER_destroy`: set to `no` to keep the VMs after the test run. Set to `onpass` to keep the VMs around only after a test failure.
|
39
42
|
* `BEAKER_keyfile`: specify alternate SSH key to access the test VMs
|
43
|
+
* `BEAKER_options_file`: set to the file path of the options file to be used as the default options for beaker. Equivalent to the `--options-file` parameter.
|
40
44
|
* `BEAKER_provision`: set to `no` to skip provisioning boxes before testing, beaker will then assume that boxes are already provisioned and reachable
|
41
45
|
* `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). The file is assumed to be in module's spec/acceptance/nodesets directory.
|
42
46
|
* `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)
|
43
47
|
|
44
48
|
For details on the specific mappings, the [setup code](https://github.com/puppetlabs/beaker-rspec/blob/2771b4b1864692690254a969680a57ff22ac0516/lib/beaker-rspec/spec_helper.rb#L26-L32) and the [beaker docs](https://github.com/puppetlabs/beaker/blob/master/docs/tutorials/the_command_line.md).
|
45
49
|
|
46
|
-
#Building your Module Testing Environment
|
50
|
+
# Building your Module Testing Environment
|
47
51
|
|
48
52
|
Using puppetlabs-mysql as an example module.
|
49
53
|
|
50
|
-
##Clone the module repository of the module where you want to add tests
|
54
|
+
## Clone the module repository of the module where you want to add tests
|
51
55
|
|
52
56
|
git clone https://github.com/puppetlabs/puppetlabs-mysql
|
53
57
|
cd puppetlabs-mysql
|
54
58
|
|
55
|
-
##Install beaker-rspec
|
59
|
+
## Install beaker-rspec
|
56
60
|
|
57
61
|
In module's top level directory edit the Gemfile. You should see a `:system_tests`
|
58
62
|
or `:acceptance` group there, but if not, add beaker-rspec there:
|
@@ -67,7 +71,7 @@ Then run
|
|
67
71
|
|
68
72
|
bundle install
|
69
73
|
|
70
|
-
##Create node files
|
74
|
+
## Create node files
|
71
75
|
|
72
76
|
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.
|
73
77
|
|
@@ -83,7 +87,7 @@ Create the nodesets directory. From module's top level directory:
|
|
83
87
|
|
84
88
|
Copy any nodesets that you wish to use into the nodesets directory.
|
85
89
|
|
86
|
-
##Create the spec_helper_acceptance.rb
|
90
|
+
## Create the spec_helper_acceptance.rb
|
87
91
|
|
88
92
|
In the `spec` folder, you should see the project's `spec_helper_acceptance.rb`.
|
89
93
|
This file contains all of the setup logic needed to get your Systems Under Test
|
@@ -133,7 +137,7 @@ This method will install the latest puppet-agent from the specified
|
|
133
137
|
|
134
138
|
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`)
|
135
139
|
|
136
|
-
##Create spec tests for your module
|
140
|
+
## Create spec tests for your module
|
137
141
|
|
138
142
|
Spec tests are written in [RSpec](http://rspec.info). You can also use [serverspec](http://serverspec.org/) matchers to test [resources](http://serverspec.org/resource_types.html).
|
139
143
|
|
@@ -178,8 +182,10 @@ describe 'mysql::server::account_security class' do
|
|
178
182
|
end
|
179
183
|
```
|
180
184
|
|
181
|
-
##Run your spec tests
|
185
|
+
## Run your spec tests
|
182
186
|
|
183
187
|
From module's top level directory
|
184
188
|
|
185
|
-
|
189
|
+
```
|
190
|
+
bundle exec rspec spec/acceptance
|
191
|
+
```
|
@@ -30,9 +30,10 @@ RSpec.configure do |c|
|
|
30
30
|
:keyfile => ENV['BEAKER_keyfile'] || ENV['RS_KEYFILE'],
|
31
31
|
:debug => ENV['BEAKER_debug'] || ENV['RS_DEBUG'],
|
32
32
|
:destroy => ENV['BEAKER_destroy'] || ENV['RS_DESTROY'],
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
:optionsfile => ENV['BEAKER_options_file'] || ENV['RS_OPTIONS_FILE'],
|
34
|
+
}.delete_if {|key, value| value.nil?}
|
35
|
+
#combine defaults and env_vars to determine overall options
|
36
|
+
options = defaults.merge(env_vars)
|
36
37
|
|
37
38
|
# process options to construct beaker command string
|
38
39
|
nodesetfile = options[:nodesetfile] || File.join('spec/acceptance/nodesets',"#{options[:nodeset]}.yml")
|
@@ -40,9 +41,10 @@ RSpec.configure do |c|
|
|
40
41
|
keyfile = options[:keyfile] ? ['--keyfile', options[:keyfile]] : nil
|
41
42
|
debug = options[:debug] ? ['--log-level', 'debug'] : nil
|
42
43
|
color = options[:color] == 'no' ? ['--no-color'] : nil
|
44
|
+
options_file = options[:optionsfile] ? ['--options-file',options[:optionsfile]] || nil
|
43
45
|
|
44
46
|
# Configure all nodes in nodeset
|
45
|
-
c.setup([fresh_nodes, '--hosts', nodesetfile, keyfile, debug, color].flatten.compact)
|
47
|
+
c.setup([fresh_nodes, '--hosts', nodesetfile, keyfile, debug, color, options_file]).flatten.compact)
|
46
48
|
c.provision
|
47
49
|
c.validate
|
48
50
|
c.configure
|
data/lib/beaker-rspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|