rspec-puppet 3.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -3
- data/README.md +58 -178
- data/lib/rspec-puppet/adapters.rb +63 -221
- data/lib/rspec-puppet/consts.rb +1 -1
- data/lib/rspec-puppet/example/function_example_group.rb +25 -45
- data/lib/rspec-puppet/example.rb +0 -2
- data/lib/rspec-puppet/matchers/compile.rb +1 -1
- data/lib/rspec-puppet/matchers/create_generic.rb +1 -1
- data/lib/rspec-puppet/matchers/dynamic_matchers.rb +2 -2
- data/lib/rspec-puppet/monkey_patches.rb +33 -46
- data/lib/rspec-puppet/sensitive.rb +29 -39
- data/lib/rspec-puppet/setup.rb +2 -8
- data/lib/rspec-puppet/spec_helper.rb +0 -3
- data/lib/rspec-puppet/support.rb +27 -74
- data/lib/rspec-puppet/version.rb +1 -1
- data/lib/rspec-puppet.rb +0 -16
- metadata +7 -8
- data/lib/rspec-puppet/example/application_example_group.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cd03a236a8ecccba9131563b0eb1cba1acbf1527fc3fa3a26f73aa0ed71b8bf
|
4
|
+
data.tar.gz: 26e3dd952e69e4481ab11ea9adc03a9df5b7a5a6b1dd968cac08e1cd02665f30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e4e98146c015657bf6507b08aed32d4f3dc24f44e9b04539054465df4025c5dc737d7b42e261553cdcbf0a75b84812c739243a41514689395d7505571f23ea5
|
7
|
+
data.tar.gz: de6e30c989030a40a781fdadefcb88b3b70a7bcb3372ec869f1ddc03d7b00ec50fd4f9cbfc1450c00e96ef5d9eb061244938d1ff629df654f9aeb595e004573c
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
|
6
6
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
|
7
7
|
|
8
|
+
## [v4.0.1](https://github.com/puppetlabs/rspec-puppet/tree/v4.0.1) - 2023-11-22
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v4.0.0...v4.0.1)
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- (maint) - Add original owners [#90](https://github.com/puppetlabs/rspec-puppet/pull/90) ([jordanbreen28](https://github.com/jordanbreen28))
|
15
|
+
|
16
|
+
## [v4.0.0](https://github.com/puppetlabs/rspec-puppet/tree/v4.0.0) - 2023-10-09
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v3.0.0...v4.0.0)
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
- (CAT-1226) - Remove Compatibility for Puppet 7.10 and below [#73](https://github.com/puppetlabs/rspec-puppet/pull/73) ([jordanbreen28](https://github.com/jordanbreen28))
|
22
|
+
- Drop RSpec 2 & Ruby 1 compatiblity [#67](https://github.com/puppetlabs/rspec-puppet/pull/67) ([ekohl](https://github.com/ekohl))
|
23
|
+
- Remove puppet applications support [#54](https://github.com/puppetlabs/rspec-puppet/pull/54) ([nabertrand](https://github.com/nabertrand))
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- Avoid hardcoding ipaddress6 default [#61](https://github.com/puppetlabs/rspec-puppet/pull/61) ([ekohl](https://github.com/ekohl))
|
28
|
+
|
8
29
|
## [v3.0.0](https://github.com/puppetlabs/rspec-puppet/tree/v3.0.0) - 2023-04-25
|
9
30
|
|
10
31
|
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v3.0.0.rc.1...v3.0.0)
|
@@ -13,13 +34,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
13
34
|
|
14
35
|
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v2.12.0...v3.0.0.rc.1)
|
15
36
|
|
37
|
+
### Changed
|
38
|
+
- (CONT-808) Ruby 3 / Puppet 8 Support [#48](https://github.com/puppetlabs/rspec-puppet/pull/48) ([chelnak](https://github.com/chelnak))
|
39
|
+
|
16
40
|
### Added
|
17
41
|
|
18
42
|
- Support dot-notation when retrieving facts in facter_impl [#46](https://github.com/puppetlabs/rspec-puppet/pull/46) ([alexjfisher](https://github.com/alexjfisher))
|
19
43
|
|
20
|
-
### Changed
|
21
|
-
- (CONT-808) Ruby 3 / Puppet 8 Support [#48](https://github.com/puppetlabs/rspec-puppet/pull/48) ([chelnak](https://github.com/chelnak))
|
22
|
-
|
23
44
|
### Fixed
|
24
45
|
|
25
46
|
- Default to current versions of Puppet and Facter [#36](https://github.com/puppetlabs/rspec-puppet/pull/36) ([ekohl](https://github.com/ekohl))
|
data/README.md
CHANGED
@@ -1,52 +1,39 @@
|
|
1
1
|
# RSpec tests for your Puppet manifests & modules
|
2
2
|
|
3
|
+
[![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/rspec-puppet/blob/main/CODEOWNERS)
|
4
|
+
![ci](https://github.com/puppetlabs/rspec-puppet/actions/workflows/ci.yml/badge.svg)
|
5
|
+
![GitHub release (latest by date)](https://img.shields.io/github/v/release/puppetlabs/rspec-puppet)
|
6
|
+
|
3
7
|
#### Table of Contents
|
4
8
|
|
5
9
|
* [Installation](#installation)
|
6
10
|
* [Starting out with a new module](#starting-out-with-a-new-module)
|
7
|
-
* [Configure manifests for Puppet 4](#configure-manifests-for-puppet-4)
|
8
11
|
* [Configuration](#configuration)
|
9
12
|
* [Naming conventions](#naming-conventions)
|
10
13
|
* [Example groups](#example-groups)
|
11
|
-
* [Defined Types
|
14
|
+
* [Defined Types and Classes](#defined-types-and-classes)
|
12
15
|
* [Functions](#functions)
|
13
16
|
* [Hiera integration](#hiera-integration)
|
14
17
|
* [Producing coverage reports](#producing-coverage-reports)
|
15
18
|
* [Related projects](#related-projects)
|
19
|
+
* [Development](#development)
|
20
|
+
* [License](#license)
|
16
21
|
|
17
22
|
## Installation
|
18
23
|
|
19
24
|
gem install rspec-puppet
|
20
25
|
|
21
|
-
> Note for ruby 1.8 users: while rspec-puppet itself supports ruby 1.8, you'll
|
22
|
-
> need to pin rspec itself to `~> 3.1.0`, as later rspec versions do not work
|
23
|
-
> on old rubies anymore.
|
24
|
-
|
25
26
|
## Starting out with a new module
|
26
27
|
|
27
28
|
When you start out on a new module, create a metadata.json file for your module and then run `rspec-puppet-init` to create the necessary files to configure rspec-puppet for your module's tests.
|
28
29
|
|
29
|
-
|
30
|
-
## Configure manifests for Puppet 4
|
31
|
-
|
32
|
-
With Puppet 3, the manifest is set to `$manifestdir/site.pp`. However Puppet 4 defaults to an empty value. In order to test manifests you will need to set appropriate settings.
|
33
|
-
|
34
|
-
Puppet configuration reference for `manifest` can be found online:
|
35
|
-
|
36
|
-
* Puppet 3: https://docs.puppet.com/puppet/3.8/reference/configuration.html#manifest
|
37
|
-
* Puppet 4: https://docs.puppet.com/puppet/4.8/reference/configuration.html#manifest
|
38
|
-
|
39
30
|
Configuration is typically done in a `spec/spec_helper.rb` file which each of your spec will require. Example code:
|
40
|
-
```ruby
|
41
|
-
# /spec
|
42
|
-
base_dir = File.dirname(File.expand_path(__FILE__))
|
43
31
|
|
32
|
+
```ruby
|
44
33
|
RSpec.configure do |c|
|
45
|
-
c.module_path = File.join(
|
46
|
-
c.manifest_dir = File.join(base_dir, 'fixtures', 'manifests')
|
47
|
-
c.manifest = File.join(base_dir, 'fixtures', 'manifests', 'site.pp')
|
34
|
+
c.module_path = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'modules')
|
48
35
|
c.environmentpath = File.join(Dir.pwd, 'spec')
|
49
|
-
|
36
|
+
c.manifest = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'manifests', 'site.pp')
|
50
37
|
# Coverage generation
|
51
38
|
c.after(:suite) do
|
52
39
|
RSpec::Puppet::Coverage.report!
|
@@ -59,131 +46,80 @@ end
|
|
59
46
|
rspec-puppet can be configured by modifying the `RSpec.configure` block in your
|
60
47
|
`spec/spec_helper.rb` file.
|
61
48
|
|
62
|
-
```
|
49
|
+
```ruby
|
63
50
|
RSpec.configure do |c|
|
64
51
|
c.<config option> = <value>
|
65
52
|
end
|
66
53
|
```
|
67
54
|
|
68
|
-
#### manifest\_dir
|
69
|
-
Type | Default | Puppet Version(s)
|
70
|
-
------ | -------- | -----------------
|
71
|
-
String | Required | 2.x, 3.x
|
72
|
-
|
73
|
-
The path to the directory containing your basic manifests like `site.pp`.
|
74
|
-
|
75
55
|
#### module\_path
|
76
56
|
Type | Default | Puppet Version(s)
|
77
57
|
------ | -------- | ------------------
|
78
|
-
String | Required |
|
58
|
+
String | Required | any
|
79
59
|
|
80
60
|
The path to the directory containing your Puppet modules.
|
81
61
|
|
82
62
|
#### default\_facts
|
83
63
|
Type | Default | Puppet Version(s)
|
84
64
|
---- | ------- | ------------------
|
85
|
-
Hash | `{}` |
|
65
|
+
Hash | `{}` | any
|
86
66
|
|
87
67
|
A hash of default facts that should be used for all the tests.
|
88
68
|
|
89
69
|
#### hiera\_config
|
90
70
|
Type | Default | Puppet Version(s)
|
91
71
|
------ | ------------- | -----------------
|
92
|
-
String | `"/dev/null"` |
|
72
|
+
String | `"/dev/null"` | any
|
93
73
|
|
94
74
|
The path to your `hiera.yaml` file (if used).
|
95
75
|
|
76
|
+
#### manifest
|
77
|
+
Type | Default | Puppet Version(s)
|
78
|
+
------ | ---------------------- | -----------------
|
79
|
+
String | Puppet's default value | any
|
80
|
+
|
81
|
+
Path to test manifest. Typically `spec/fixtures/manifests/site.pp`.
|
82
|
+
|
96
83
|
#### default\_node\_params
|
97
84
|
Type | Default | Puppet Version(s)
|
98
85
|
---- | ------- | -----------------
|
99
|
-
Hash | `{}` |
|
86
|
+
Hash | `{}` | any
|
100
87
|
|
101
88
|
A hash of default node parameters that should be used for all the tests.
|
102
89
|
|
103
90
|
#### default\_trusted\_facts
|
104
91
|
Type | Default | Puppet Version(s)
|
105
92
|
---- | ------- | -----------------
|
106
|
-
Hash | `{}` |
|
93
|
+
Hash | `{}` | any
|
107
94
|
|
108
95
|
A hash of default trusted facts that should be used for all the tests
|
109
|
-
(available in the manifests as the `$trusted` hash).
|
110
|
-
`trusted_node_data` setting must be set to `true`.
|
111
|
-
|
112
|
-
#### trusted\_node\_data
|
113
|
-
Type | Default | Puppet Version(s)
|
114
|
-
------- | ------- | -----------------
|
115
|
-
Boolean | `false` | >=3.4, 4.x, 5.x
|
116
|
-
|
117
|
-
Configures rspec-puppet to use the `$trusted` hash when compiling the
|
118
|
-
catalogues.
|
119
|
-
|
120
|
-
#### trusted\_server\_facts
|
121
|
-
Type | Default | Puppet Version(s)
|
122
|
-
------- | ------- | -----------------
|
123
|
-
Boolean | `false` | >=4.3, 5.x
|
124
|
-
|
125
|
-
Configures rspec-puppet to use the `$server_facts` hash when compiling the
|
126
|
-
catalogues.
|
96
|
+
(available in the manifests as the `$trusted` hash).
|
127
97
|
|
128
98
|
#### confdir
|
129
99
|
Type | Default | Puppet Version(s)
|
130
100
|
------ | --------------- | ------------------
|
131
|
-
String | `"/etc/puppet"` |
|
101
|
+
String | `"/etc/puppet"` | any
|
132
102
|
|
133
103
|
The path to the main Puppet configuration directory.
|
134
104
|
|
135
105
|
#### config
|
136
106
|
Type | Default | Puppet Version(s)
|
137
107
|
------ | ---------------------- | ------------------
|
138
|
-
String | Puppet's default value |
|
108
|
+
String | Puppet's default value | any
|
139
109
|
|
140
110
|
The path to `puppet.conf`.
|
141
111
|
|
142
|
-
#### manifest
|
143
|
-
Type | Default | Puppet Version(s)
|
144
|
-
------ | ---------------------- | -----------------
|
145
|
-
String | Puppet's default value | 2.x, 3.x
|
146
|
-
|
147
|
-
The entry-point manifest for Puppet, usually `$manifest_dir/site.pp`.
|
148
|
-
|
149
|
-
#### template\_dir
|
150
|
-
Type | Default | Puppet Version(s)
|
151
|
-
------ | ------- | -----------------
|
152
|
-
String | `nil` | 2.x, 3.x
|
153
|
-
|
154
|
-
The path to the directory that Puppet should search for templates that are
|
155
|
-
stored outside of modules.
|
156
|
-
|
157
112
|
#### environmentpath
|
158
113
|
Type | Default | Puppet Version(s)
|
159
114
|
------ | ------------------------------------- | -----------------
|
160
|
-
String | `"/etc/puppetlabs/code/environments"` |
|
115
|
+
String | `"/etc/puppetlabs/code/environments"` | any
|
161
116
|
|
162
117
|
The search path for environment directories.
|
163
118
|
|
164
|
-
#### parser
|
165
|
-
Type | Default | Puppet Version(s)
|
166
|
-
------ | ----------- | -----------------
|
167
|
-
String | `"current"` | >= 3.2
|
168
|
-
|
169
|
-
This switches between the 3.x (`current`) and 4.x (`future`) parsers.
|
170
|
-
|
171
|
-
#### ordering
|
172
|
-
Type | Default | Puppet Version(s)
|
173
|
-
------ | -------------- | -----------------
|
174
|
-
String | `"title-hash"` | >= 3.3, 4.x, 5.x
|
175
|
-
|
176
|
-
How unrelated resources should be ordered when applying a catalogue.
|
177
|
-
* `manifest` - Use the order in which the resources are declared in the
|
178
|
-
manifest.
|
179
|
-
* `title-hash` - Order the resources randomly, but in a consistent manner
|
180
|
-
across runs (the order will only change if the manifest changes).
|
181
|
-
* `random` - Order the resources randomly.
|
182
|
-
|
183
119
|
#### strict\_variables
|
184
120
|
Type | Default | Puppet Version(s)
|
185
121
|
------- | ------- | -----------------
|
186
|
-
Boolean | `false` |
|
122
|
+
Boolean | `false` | any
|
187
123
|
|
188
124
|
Makes Puppet raise an error when it tries to reference a variable that hasn't
|
189
125
|
been defined (not including variables that have been explicitly set to
|
@@ -192,7 +128,7 @@ been defined (not including variables that have been explicitly set to
|
|
192
128
|
#### stringify\_facts
|
193
129
|
Type | Default | Puppet Version(s)
|
194
130
|
------- | ------- | -----------------
|
195
|
-
Boolean | `true` |
|
131
|
+
Boolean | `true` | any
|
196
132
|
|
197
133
|
Makes rspec-puppet coerce all the fact values into strings (matching the
|
198
134
|
behaviour of older versions of Puppet).
|
@@ -200,7 +136,7 @@ behaviour of older versions of Puppet).
|
|
200
136
|
#### enable\_pathname\_stubbing
|
201
137
|
Type | Default | Puppet Version(s)
|
202
138
|
------- | ------- | ------------------
|
203
|
-
Boolean |`false` |
|
139
|
+
Boolean |`false` | any
|
204
140
|
|
205
141
|
Configures rspec-puppet to stub out `Pathname#absolute?` with it's own
|
206
142
|
implementation. This should only be enabled if you're running into an issue
|
@@ -210,7 +146,7 @@ functions, etc) that use `Pathname#absolute?`.
|
|
210
146
|
#### setup\_fixtures
|
211
147
|
Type | Default | Puppet Version(s)
|
212
148
|
------- | ------- | ------------------
|
213
|
-
Boolean | `true` |
|
149
|
+
Boolean | `true` | any
|
214
150
|
|
215
151
|
Configures rspec-puppet to automatically create a link from the root of your
|
216
152
|
module to `spec/fixtures/<module name>` at the beginning of the test run.
|
@@ -218,7 +154,7 @@ module to `spec/fixtures/<module name>` at the beginning of the test run.
|
|
218
154
|
#### derive\_node\_facts\_from\_nodename
|
219
155
|
Type | Default | Puppet Version(s)
|
220
156
|
------- | ------- | -----------------
|
221
|
-
Boolean | `true` |
|
157
|
+
Boolean | `true` | any
|
222
158
|
|
223
159
|
If `true`, rspec-puppet will override the `fdqn`, `hostname`, and `domain`
|
224
160
|
facts with values that it derives from the node name (specified with
|
@@ -231,7 +167,7 @@ setting to `false`.
|
|
231
167
|
#### facter\_implementation
|
232
168
|
Type | Default | Puppet Version(s)
|
233
169
|
------- | -------- | -----------------
|
234
|
-
String | `facter` |
|
170
|
+
String | `facter` | any
|
235
171
|
|
236
172
|
Configures rspec-puppet to use a specific Facter implementation for running
|
237
173
|
unit tests. If the `rspec` implementation is set and Puppet does not support
|
@@ -259,9 +195,6 @@ structure and naming convention.
|
|
259
195
|
├── defines/
|
260
196
|
│ └── <define_name>_spec.rb
|
261
197
|
│
|
262
|
-
├── applications/
|
263
|
-
│ └── <application_name>_spec.rb
|
264
|
-
│
|
265
198
|
├── functions/
|
266
199
|
│ └── <function_name>_spec.rb
|
267
200
|
│
|
@@ -289,10 +222,6 @@ describe 'mydefine', :type => :define do
|
|
289
222
|
...
|
290
223
|
end
|
291
224
|
|
292
|
-
describe 'myapplication', :type => :application do
|
293
|
-
...
|
294
|
-
end
|
295
|
-
|
296
225
|
describe 'myfunction', :type => :puppet_function do
|
297
226
|
...
|
298
227
|
end
|
@@ -310,7 +239,7 @@ describe 'myhost.example.com', :type => :host do
|
|
310
239
|
end
|
311
240
|
```
|
312
241
|
|
313
|
-
## Defined Types
|
242
|
+
## Defined Types and Classes
|
314
243
|
|
315
244
|
### Matchers
|
316
245
|
|
@@ -601,7 +530,7 @@ let(:title) { 'foo' }
|
|
601
530
|
|
602
531
|
#### Specifying the parameters to pass to a resources or parameterised class
|
603
532
|
|
604
|
-
Parameters of a defined type
|
533
|
+
Parameters of a defined type or class can be passed defining `:params` in a let,
|
605
534
|
and passing it a hash as seen below.
|
606
535
|
|
607
536
|
```ruby
|
@@ -621,7 +550,7 @@ let(:params) { {'password' =>sensitive('secret') } }
|
|
621
550
|
```
|
622
551
|
|
623
552
|
For references to nodes or resources as seen when using `require` or `before` properties,
|
624
|
-
|
553
|
+
you can pass the string as an argument to the `ref` helper:
|
625
554
|
|
626
555
|
```ruby
|
627
556
|
let(:params) { 'require' => ref('Package', 'sudoku') }
|
@@ -633,18 +562,6 @@ Which translates to:
|
|
633
562
|
mydefine { 'mytitle': require => Package['sudoku'] }
|
634
563
|
```
|
635
564
|
|
636
|
-
Another example, for an application setup (when using `app_management`):
|
637
|
-
|
638
|
-
```ruby
|
639
|
-
let(:params) { { 'nodes' => { ref('Node', 'dbnode') => ref('Myapp::Mycomponent', 'myapp') } } }
|
640
|
-
```
|
641
|
-
|
642
|
-
Will translate to:
|
643
|
-
|
644
|
-
```puppet
|
645
|
-
site { myapp { 'myimpl': nodes => { Node['dbnode'] => Myapp::Mycomponent['myimpl'] } } }
|
646
|
-
```
|
647
|
-
|
648
565
|
#### Specifying the FQDN of the test node
|
649
566
|
|
650
567
|
If the manifest you're testing expects to run on host with a particular name,
|
@@ -714,8 +631,6 @@ RSpec.configure do |c|
|
|
714
631
|
end
|
715
632
|
```
|
716
633
|
|
717
|
-
**NOTE** Setting top-scope variables is not supported in Puppet < 3.0.
|
718
|
-
|
719
634
|
#### Specifying extra code to load (pre-conditions)
|
720
635
|
|
721
636
|
If the manifest being tested relies on another class or variables to be set, these can be added via
|
@@ -767,7 +682,7 @@ let(:module_path) { '/path/to/your/module/dir' }
|
|
767
682
|
|
768
683
|
#### Specifying trusted facts
|
769
684
|
|
770
|
-
|
685
|
+
The trusted facts hash will have the standard trusted fact keys
|
771
686
|
(certname, domain, and hostname) populated based on the node name (as set with `:node`).
|
772
687
|
|
773
688
|
By default, the test environment contains no custom trusted facts (as usually obtained
|
@@ -792,8 +707,7 @@ end
|
|
792
707
|
|
793
708
|
#### Specifying trusted external data
|
794
709
|
|
795
|
-
|
796
|
-
key for trusted external data.
|
710
|
+
The trusted facts hash will have an `external` key for trusted external data.
|
797
711
|
|
798
712
|
By default, the test environment contains no trusted external data (as usually obtained from
|
799
713
|
trusted external commands and found in the `external` key). If you need to test against specific
|
@@ -835,46 +749,6 @@ You can also use `exported_resources` directly in a test:
|
|
835
749
|
it { expect(exported_resources).to contain_file('foo') }
|
836
750
|
```
|
837
751
|
|
838
|
-
#### Testing applications
|
839
|
-
|
840
|
-
Applications in some ways behave as defined resources, but are more complex so
|
841
|
-
require a number of elements already documented above to be combined for testing.
|
842
|
-
|
843
|
-
A full example of the simplest rspec test for a single component application:
|
844
|
-
|
845
|
-
```ruby
|
846
|
-
require 'spec_helper'
|
847
|
-
|
848
|
-
describe 'orch_app' do
|
849
|
-
let(:node) { 'my_node' }
|
850
|
-
let(:title) { 'my_awesome_app' }
|
851
|
-
let(:params) do
|
852
|
-
{
|
853
|
-
'nodes' => {
|
854
|
-
ref('Node', node) => ref('Orch_app::Db', title),
|
855
|
-
}
|
856
|
-
}
|
857
|
-
end
|
858
|
-
|
859
|
-
it { should compile }
|
860
|
-
it { should contain_orch_app(title) }
|
861
|
-
end
|
862
|
-
```
|
863
|
-
|
864
|
-
Each piece is required:
|
865
|
-
|
866
|
-
* You must turn on app_management during testing for the handling to work
|
867
|
-
* The `:node` definition is required to be set so later on you can reference it in the `:nodes` argument within `:params`
|
868
|
-
* Applications act like defined resources, and each require a `:title` to be defined
|
869
|
-
* The `:nodes` key in `:params` requires the use of node reference mappings to resource
|
870
|
-
mappings. The `ref` keyword allows you to provide these (a normal string will not work).
|
871
|
-
|
872
|
-
Beyond these requirements, the very basic `should compile` test and other matchers
|
873
|
-
as you would expect will work the same as classes and defined resources.
|
874
|
-
|
875
|
-
**Note:** for the moment, cross-node support is not available and will return an error.
|
876
|
-
Ensure you model your tests to be single-node for the time being.
|
877
|
-
|
878
752
|
## Functions
|
879
753
|
|
880
754
|
### Matchers
|
@@ -1108,24 +982,30 @@ end
|
|
1108
982
|
```
|
1109
983
|
|
1110
984
|
Resources declared outside of the module being tested (i.e. forge dependencies)
|
1111
|
-
are automatically removed from the coverage report.
|
1112
|
-
this though: **prior to Puppet 4.6.0**, resources created by functions
|
1113
|
-
(create\_resources(), ensure\_package(), etc) did not have the required
|
1114
|
-
information in them to determine which manifest they came from and so can not
|
1115
|
-
be excluded from the coverage report.
|
985
|
+
are automatically removed from the coverage report.
|
1116
986
|
|
1117
987
|
## Related projects
|
1118
988
|
|
1119
989
|
* [puppetlabs_spec_helper](https://github.com/puppetlabs/puppetlabs_spec_helper): shared spec helpers to setup puppet
|
1120
|
-
* [rspec-puppet-augeas](https://github.com/domcleal/rspec-puppet-augeas): RSpec tests for Augeas resources inside Puppet manifests
|
1121
|
-
* [jimdo-rspec-puppet-helpers](https://github.com/Jimdo/jimdo-rspec-puppet-helpers): Tests the contents of a file with a source
|
1122
|
-
* Ease development of specs
|
1123
|
-
* [puppet-catalog_rspec](https://github.com/enterprisemodules/puppet-catalog_rspec): Dump the Puppet Catalog as RSpec code at compile time
|
1124
|
-
* [create_specs](https://github.com/alexharv074/create_specs.git): A different implementation that takes a compiled catalog and writes out RSpec code with various options
|
1125
990
|
* Fact providers
|
1126
|
-
* [rspec-puppet-facts](https://github.com/
|
1127
|
-
|
1128
|
-
|
991
|
+
* [rspec-puppet-facts](https://github.com/voxpupuli/rspec-puppet-facts): Simplify your unit tests by looping on every supported Operating System and populating facts.
|
992
|
+
|
993
|
+
For a list of other module development tools see [DevX Tools](https://puppetlabs.github.io/content-and-tooling-team/tools/), or from our trusted Voxpupuli community [here](https://voxpupuli.org/plugins/).
|
994
|
+
|
995
|
+
## Reporting bugs or incorrect results
|
996
|
+
|
997
|
+
If you find a bug in Puppet Lint or its results, please create an issue in the repo issues tracker. Bonus points will be awarded if you also include a patch that fixes the issue.
|
998
|
+
|
999
|
+
## Development
|
1000
|
+
|
1001
|
+
If you run into an issue with this tool or would like to request a feature you can raise a PR with your suggested changes. Alternatively, you can raise a Github issue with a feature request or to report any bugs. Every other Tuesday the DevX team holds office hours in the Puppet Community Slack, where you can ask questions about this and any other supported tools. This session runs at 15:00 (GMT/BST) for about an hour.
|
1002
|
+
|
1003
|
+
If you have problems getting this tool up and running, please contact Support.
|
1004
|
+
|
1005
|
+
## License
|
1006
|
+
|
1007
|
+
This codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT.
|
1129
1008
|
|
1130
|
-
|
1009
|
+
## Thank you
|
1131
1010
|
|
1011
|
+
Many thanks to the original author of rspec-puppet Tim Sharpe (@rodjek).
|