rspec-puppet 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -3
- data/README.md +54 -164
- 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 +10 -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: 291e38ca7a66506f0137223f196936d5f2f96122edd1f5769d055a98c2370229
|
4
|
+
data.tar.gz: cf627b9874f3aef7ae15b92d5f21283dfe4ceede9d0f6221be73f72d19c6803f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bbdc55d506fec8fdb26d206af5c56ad19a3a50dd4b0438853466513cbd0338087c3ca1dfff99146c530afa5194ac392fc121f2ee1aaccbb9d82b5cf6edf8e53
|
7
|
+
data.tar.gz: 2d7ee94fb1fe726e8a326413bab9b8b08a200023be91693a7a208ade86de1e848e7c443fb2b6c8847ac75fe32cfd99ca2ff27601552543204ce5b4a802dfb86e
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,19 @@ 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.0](https://github.com/puppetlabs/rspec-puppet/tree/v4.0.0) - 2023-10-09
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v3.0.0...v4.0.0)
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- (CAT-1226) - Remove Compatibility for Puppet 7.10 and below [#73](https://github.com/puppetlabs/rspec-puppet/pull/73) ([jordanbreen28](https://github.com/jordanbreen28))
|
14
|
+
- Drop RSpec 2 & Ruby 1 compatiblity [#67](https://github.com/puppetlabs/rspec-puppet/pull/67) ([ekohl](https://github.com/ekohl))
|
15
|
+
- Remove puppet applications support [#54](https://github.com/puppetlabs/rspec-puppet/pull/54) ([nabertrand](https://github.com/nabertrand))
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- Avoid hardcoding ipaddress6 default [#61](https://github.com/puppetlabs/rspec-puppet/pull/61) ([ekohl](https://github.com/ekohl))
|
20
|
+
|
8
21
|
## [v3.0.0](https://github.com/puppetlabs/rspec-puppet/tree/v3.0.0) - 2023-04-25
|
9
22
|
|
10
23
|
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v3.0.0.rc.1...v3.0.0)
|
@@ -13,13 +26,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
13
26
|
|
14
27
|
[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v2.12.0...v3.0.0.rc.1)
|
15
28
|
|
29
|
+
### Changed
|
30
|
+
- (CONT-808) Ruby 3 / Puppet 8 Support [#48](https://github.com/puppetlabs/rspec-puppet/pull/48) ([chelnak](https://github.com/chelnak))
|
31
|
+
|
16
32
|
### Added
|
17
33
|
|
18
34
|
- Support dot-notation when retrieving facts in facter_impl [#46](https://github.com/puppetlabs/rspec-puppet/pull/46) ([alexjfisher](https://github.com/alexjfisher))
|
19
35
|
|
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
36
|
### Fixed
|
24
37
|
|
25
38
|
- 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,14 +1,17 @@
|
|
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)
|
@@ -18,35 +21,17 @@
|
|
18
21
|
|
19
22
|
gem install rspec-puppet
|
20
23
|
|
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
24
|
## Starting out with a new module
|
26
25
|
|
27
26
|
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
27
|
|
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
28
|
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
29
|
|
30
|
+
```ruby
|
44
31
|
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')
|
32
|
+
c.module_path = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'modules')
|
48
33
|
c.environmentpath = File.join(Dir.pwd, 'spec')
|
49
|
-
|
34
|
+
c.manifest = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'manifests', 'site.pp')
|
50
35
|
# Coverage generation
|
51
36
|
c.after(:suite) do
|
52
37
|
RSpec::Puppet::Coverage.report!
|
@@ -59,60 +44,59 @@ end
|
|
59
44
|
rspec-puppet can be configured by modifying the `RSpec.configure` block in your
|
60
45
|
`spec/spec_helper.rb` file.
|
61
46
|
|
62
|
-
```
|
47
|
+
```ruby
|
63
48
|
RSpec.configure do |c|
|
64
49
|
c.<config option> = <value>
|
65
50
|
end
|
66
51
|
```
|
67
52
|
|
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
53
|
#### module\_path
|
76
54
|
Type | Default | Puppet Version(s)
|
77
55
|
------ | -------- | ------------------
|
78
|
-
String | Required |
|
56
|
+
String | Required | any
|
79
57
|
|
80
58
|
The path to the directory containing your Puppet modules.
|
81
59
|
|
82
60
|
#### default\_facts
|
83
61
|
Type | Default | Puppet Version(s)
|
84
62
|
---- | ------- | ------------------
|
85
|
-
Hash | `{}` |
|
63
|
+
Hash | `{}` | any
|
86
64
|
|
87
65
|
A hash of default facts that should be used for all the tests.
|
88
66
|
|
89
67
|
#### hiera\_config
|
90
68
|
Type | Default | Puppet Version(s)
|
91
69
|
------ | ------------- | -----------------
|
92
|
-
String | `"/dev/null"` |
|
70
|
+
String | `"/dev/null"` | any
|
93
71
|
|
94
72
|
The path to your `hiera.yaml` file (if used).
|
95
73
|
|
74
|
+
#### manifest
|
75
|
+
Type | Default | Puppet Version(s)
|
76
|
+
------ | ---------------------- | -----------------
|
77
|
+
String | Puppet's default value | any
|
78
|
+
|
79
|
+
Path to test manifest. Typically `spec/fixtures/manifests/site.pp`.
|
80
|
+
|
96
81
|
#### default\_node\_params
|
97
82
|
Type | Default | Puppet Version(s)
|
98
83
|
---- | ------- | -----------------
|
99
|
-
Hash | `{}` |
|
84
|
+
Hash | `{}` | any
|
100
85
|
|
101
86
|
A hash of default node parameters that should be used for all the tests.
|
102
87
|
|
103
88
|
#### default\_trusted\_facts
|
104
89
|
Type | Default | Puppet Version(s)
|
105
90
|
---- | ------- | -----------------
|
106
|
-
Hash | `{}` |
|
91
|
+
Hash | `{}` | any
|
107
92
|
|
108
93
|
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`.
|
94
|
+
(available in the manifests as the `$trusted` hash).
|
111
95
|
|
112
96
|
#### trusted\_node\_data
|
113
97
|
Type | Default | Puppet Version(s)
|
114
98
|
------- | ------- | -----------------
|
115
|
-
Boolean | `false` |
|
99
|
+
Boolean | `false` | any
|
116
100
|
|
117
101
|
Configures rspec-puppet to use the `$trusted` hash when compiling the
|
118
102
|
catalogues.
|
@@ -120,7 +104,7 @@ catalogues.
|
|
120
104
|
#### trusted\_server\_facts
|
121
105
|
Type | Default | Puppet Version(s)
|
122
106
|
------- | ------- | -----------------
|
123
|
-
Boolean | `false` |
|
107
|
+
Boolean | `false` | any
|
124
108
|
|
125
109
|
Configures rspec-puppet to use the `$server_facts` hash when compiling the
|
126
110
|
catalogues.
|
@@ -128,62 +112,28 @@ catalogues.
|
|
128
112
|
#### confdir
|
129
113
|
Type | Default | Puppet Version(s)
|
130
114
|
------ | --------------- | ------------------
|
131
|
-
String | `"/etc/puppet"` |
|
115
|
+
String | `"/etc/puppet"` | any
|
132
116
|
|
133
117
|
The path to the main Puppet configuration directory.
|
134
118
|
|
135
119
|
#### config
|
136
120
|
Type | Default | Puppet Version(s)
|
137
121
|
------ | ---------------------- | ------------------
|
138
|
-
String | Puppet's default value |
|
122
|
+
String | Puppet's default value | any
|
139
123
|
|
140
124
|
The path to `puppet.conf`.
|
141
125
|
|
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
126
|
#### environmentpath
|
158
127
|
Type | Default | Puppet Version(s)
|
159
128
|
------ | ------------------------------------- | -----------------
|
160
|
-
String | `"/etc/puppetlabs/code/environments"` |
|
129
|
+
String | `"/etc/puppetlabs/code/environments"` | any
|
161
130
|
|
162
131
|
The search path for environment directories.
|
163
132
|
|
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
133
|
#### strict\_variables
|
184
134
|
Type | Default | Puppet Version(s)
|
185
135
|
------- | ------- | -----------------
|
186
|
-
Boolean | `false` |
|
136
|
+
Boolean | `false` | any
|
187
137
|
|
188
138
|
Makes Puppet raise an error when it tries to reference a variable that hasn't
|
189
139
|
been defined (not including variables that have been explicitly set to
|
@@ -192,7 +142,7 @@ been defined (not including variables that have been explicitly set to
|
|
192
142
|
#### stringify\_facts
|
193
143
|
Type | Default | Puppet Version(s)
|
194
144
|
------- | ------- | -----------------
|
195
|
-
Boolean | `true` |
|
145
|
+
Boolean | `true` | any
|
196
146
|
|
197
147
|
Makes rspec-puppet coerce all the fact values into strings (matching the
|
198
148
|
behaviour of older versions of Puppet).
|
@@ -200,7 +150,7 @@ behaviour of older versions of Puppet).
|
|
200
150
|
#### enable\_pathname\_stubbing
|
201
151
|
Type | Default | Puppet Version(s)
|
202
152
|
------- | ------- | ------------------
|
203
|
-
Boolean |`false` |
|
153
|
+
Boolean |`false` | any
|
204
154
|
|
205
155
|
Configures rspec-puppet to stub out `Pathname#absolute?` with it's own
|
206
156
|
implementation. This should only be enabled if you're running into an issue
|
@@ -210,7 +160,7 @@ functions, etc) that use `Pathname#absolute?`.
|
|
210
160
|
#### setup\_fixtures
|
211
161
|
Type | Default | Puppet Version(s)
|
212
162
|
------- | ------- | ------------------
|
213
|
-
Boolean | `true` |
|
163
|
+
Boolean | `true` | any
|
214
164
|
|
215
165
|
Configures rspec-puppet to automatically create a link from the root of your
|
216
166
|
module to `spec/fixtures/<module name>` at the beginning of the test run.
|
@@ -218,7 +168,7 @@ module to `spec/fixtures/<module name>` at the beginning of the test run.
|
|
218
168
|
#### derive\_node\_facts\_from\_nodename
|
219
169
|
Type | Default | Puppet Version(s)
|
220
170
|
------- | ------- | -----------------
|
221
|
-
Boolean | `true` |
|
171
|
+
Boolean | `true` | any
|
222
172
|
|
223
173
|
If `true`, rspec-puppet will override the `fdqn`, `hostname`, and `domain`
|
224
174
|
facts with values that it derives from the node name (specified with
|
@@ -231,7 +181,7 @@ setting to `false`.
|
|
231
181
|
#### facter\_implementation
|
232
182
|
Type | Default | Puppet Version(s)
|
233
183
|
------- | -------- | -----------------
|
234
|
-
String | `facter` |
|
184
|
+
String | `facter` | any
|
235
185
|
|
236
186
|
Configures rspec-puppet to use a specific Facter implementation for running
|
237
187
|
unit tests. If the `rspec` implementation is set and Puppet does not support
|
@@ -259,9 +209,6 @@ structure and naming convention.
|
|
259
209
|
├── defines/
|
260
210
|
│ └── <define_name>_spec.rb
|
261
211
|
│
|
262
|
-
├── applications/
|
263
|
-
│ └── <application_name>_spec.rb
|
264
|
-
│
|
265
212
|
├── functions/
|
266
213
|
│ └── <function_name>_spec.rb
|
267
214
|
│
|
@@ -289,10 +236,6 @@ describe 'mydefine', :type => :define do
|
|
289
236
|
...
|
290
237
|
end
|
291
238
|
|
292
|
-
describe 'myapplication', :type => :application do
|
293
|
-
...
|
294
|
-
end
|
295
|
-
|
296
239
|
describe 'myfunction', :type => :puppet_function do
|
297
240
|
...
|
298
241
|
end
|
@@ -310,7 +253,7 @@ describe 'myhost.example.com', :type => :host do
|
|
310
253
|
end
|
311
254
|
```
|
312
255
|
|
313
|
-
## Defined Types
|
256
|
+
## Defined Types and Classes
|
314
257
|
|
315
258
|
### Matchers
|
316
259
|
|
@@ -601,7 +544,7 @@ let(:title) { 'foo' }
|
|
601
544
|
|
602
545
|
#### Specifying the parameters to pass to a resources or parameterised class
|
603
546
|
|
604
|
-
Parameters of a defined type
|
547
|
+
Parameters of a defined type or class can be passed defining `:params` in a let,
|
605
548
|
and passing it a hash as seen below.
|
606
549
|
|
607
550
|
```ruby
|
@@ -621,7 +564,7 @@ let(:params) { {'password' =>sensitive('secret') } }
|
|
621
564
|
```
|
622
565
|
|
623
566
|
For references to nodes or resources as seen when using `require` or `before` properties,
|
624
|
-
|
567
|
+
you can pass the string as an argument to the `ref` helper:
|
625
568
|
|
626
569
|
```ruby
|
627
570
|
let(:params) { 'require' => ref('Package', 'sudoku') }
|
@@ -633,18 +576,6 @@ Which translates to:
|
|
633
576
|
mydefine { 'mytitle': require => Package['sudoku'] }
|
634
577
|
```
|
635
578
|
|
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
579
|
#### Specifying the FQDN of the test node
|
649
580
|
|
650
581
|
If the manifest you're testing expects to run on host with a particular name,
|
@@ -714,8 +645,6 @@ RSpec.configure do |c|
|
|
714
645
|
end
|
715
646
|
```
|
716
647
|
|
717
|
-
**NOTE** Setting top-scope variables is not supported in Puppet < 3.0.
|
718
|
-
|
719
648
|
#### Specifying extra code to load (pre-conditions)
|
720
649
|
|
721
650
|
If the manifest being tested relies on another class or variables to be set, these can be added via
|
@@ -767,7 +696,7 @@ let(:module_path) { '/path/to/your/module/dir' }
|
|
767
696
|
|
768
697
|
#### Specifying trusted facts
|
769
698
|
|
770
|
-
|
699
|
+
The trusted facts hash will have the standard trusted fact keys
|
771
700
|
(certname, domain, and hostname) populated based on the node name (as set with `:node`).
|
772
701
|
|
773
702
|
By default, the test environment contains no custom trusted facts (as usually obtained
|
@@ -792,8 +721,7 @@ end
|
|
792
721
|
|
793
722
|
#### Specifying trusted external data
|
794
723
|
|
795
|
-
|
796
|
-
key for trusted external data.
|
724
|
+
The trusted facts hash will have an `external` key for trusted external data.
|
797
725
|
|
798
726
|
By default, the test environment contains no trusted external data (as usually obtained from
|
799
727
|
trusted external commands and found in the `external` key). If you need to test against specific
|
@@ -835,46 +763,6 @@ You can also use `exported_resources` directly in a test:
|
|
835
763
|
it { expect(exported_resources).to contain_file('foo') }
|
836
764
|
```
|
837
765
|
|
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
766
|
## Functions
|
879
767
|
|
880
768
|
### Matchers
|
@@ -1108,24 +996,26 @@ end
|
|
1108
996
|
```
|
1109
997
|
|
1110
998
|
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.
|
999
|
+
are automatically removed from the coverage report.
|
1116
1000
|
|
1117
1001
|
## Related projects
|
1118
1002
|
|
1119
1003
|
* [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
1004
|
* Fact providers
|
1126
|
-
* [rspec-puppet-facts](https://github.com/
|
1127
|
-
|
1128
|
-
|
1005
|
+
* [rspec-puppet-facts](https://github.com/voxpupuli/rspec-puppet-facts): Simplify your unit tests by looping on every supported Operating System and populating facts.
|
1006
|
+
|
1007
|
+
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/).
|
1008
|
+
|
1009
|
+
## Reporting bugs or incorrect results
|
1010
|
+
|
1011
|
+
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.
|
1012
|
+
|
1013
|
+
## Development
|
1014
|
+
|
1015
|
+
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.
|
1016
|
+
|
1017
|
+
If you have problems getting this tool up and running, please contact Support.
|
1129
1018
|
|
1130
|
-
|
1019
|
+
## Thank you
|
1131
1020
|
|
1021
|
+
Many thanks to the original author of rspec-puppet Tim Sharpe (@rodjek).
|