Skip to content

Commit 902fb76

Browse files
ekohljordanbreen28
authored andcommitted
(CAT-1226) - Raise minimum version to Puppet 7.11
This avoids the need to have any version specific code and it's the only thing that's testing in CI.
1 parent 3a564a0 commit 902fb76

22 files changed

+186
-746
lines changed

README.md

Lines changed: 21 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,16 @@
2222

2323
gem install rspec-puppet
2424

25-
> Note for ruby 1.8 users: while rspec-puppet itself supports ruby 1.8, you'll
26-
> need to pin rspec itself to `~> 3.1.0`, as later rspec versions do not work
27-
> on old rubies anymore.
28-
2925
## Starting out with a new module
3026

3127
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.
3228

33-
34-
## Configure manifests for Puppet 4
35-
36-
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.
37-
38-
Puppet configuration reference for `manifest` can be found online:
39-
40-
* Puppet 3: https://docs.puppet.com/puppet/3.8/reference/configuration.html#manifest
41-
* Puppet 4: https://docs.puppet.com/puppet/4.8/reference/configuration.html#manifest
42-
4329
Configuration is typically done in a `spec/spec_helper.rb` file which each of your spec will require. Example code:
4430
```ruby
45-
# /spec
46-
base_dir = File.dirname(File.expand_path(__FILE__))
47-
4831
RSpec.configure do |c|
49-
c.module_path = File.join(base_dir, 'fixtures', 'modules')
50-
c.manifest_dir = File.join(base_dir, 'fixtures', 'manifests')
51-
c.manifest = File.join(base_dir, 'fixtures', 'manifests', 'site.pp')
32+
c.module_path = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'modules')
5233
c.environmentpath = File.join(Dir.pwd, 'spec')
53-
34+
c.manifest = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'manifests', 'site.pp')
5435
# Coverage generation
5536
c.after(:suite) do
5637
RSpec::Puppet::Coverage.report!
@@ -69,125 +50,83 @@ RSpec.configure do |c|
6950
end
7051
```
7152

72-
#### manifest\_dir
73-
Type | Default | Puppet Version(s)
74-
------ | -------- | -----------------
75-
String | Required | 2.x, 3.x
76-
77-
The path to the directory containing your basic manifests like `site.pp`.
78-
7953
#### module\_path
8054
Type | Default | Puppet Version(s)
8155
------ | -------- | ------------------
82-
String | Required | 2.x, 3.x, 4.x, 5.x
56+
String | Required | any
8357

8458
The path to the directory containing your Puppet modules.
8559

8660
#### default\_facts
8761
Type | Default | Puppet Version(s)
8862
---- | ------- | ------------------
89-
Hash | `{}` | 2.x, 3.x, 4.x, 5.x
63+
Hash | `{}` | any
9064

9165
A hash of default facts that should be used for all the tests.
9266

9367
#### hiera\_config
9468
Type | Default | Puppet Version(s)
9569
------ | ------------- | -----------------
96-
String | `"/dev/null"` | 3.x, 4.x, 5.x
70+
String | `"/dev/null"` | any
9771

9872
The path to your `hiera.yaml` file (if used).
9973

10074
#### default\_node\_params
10175
Type | Default | Puppet Version(s)
10276
---- | ------- | -----------------
103-
Hash | `{}` | 4.x, 5.x
77+
Hash | `{}` | any
10478

10579
A hash of default node parameters that should be used for all the tests.
10680

10781
#### default\_trusted\_facts
10882
Type | Default | Puppet Version(s)
10983
---- | ------- | -----------------
110-
Hash | `{}` | 4.x, 5.x
84+
Hash | `{}` | any
11185

11286
A hash of default trusted facts that should be used for all the tests
113-
(available in the manifests as the `$trusted` hash). In order to use this, the
114-
`trusted_node_data` setting must be set to `true`.
87+
(available in the manifests as the `$trusted` hash).
11588

11689
#### trusted\_node\_data
11790
Type | Default | Puppet Version(s)
11891
------- | ------- | -----------------
119-
Boolean | `false` | >=3.4, 4.x, 5.x
92+
Boolean | `false` | any
12093

12194
Configures rspec-puppet to use the `$trusted` hash when compiling the
12295
catalogues.
12396

12497
#### trusted\_server\_facts
12598
Type | Default | Puppet Version(s)
12699
------- | ------- | -----------------
127-
Boolean | `false` | >=4.3, 5.x
100+
Boolean | `false` | any
128101

129102
Configures rspec-puppet to use the `$server_facts` hash when compiling the
130103
catalogues.
131104

132105
#### confdir
133106
Type | Default | Puppet Version(s)
134107
------ | --------------- | ------------------
135-
String | `"/etc/puppet"` | 2.x, 3.x, 4.x, 5.x
108+
String | `"/etc/puppet"` | any
136109

137110
The path to the main Puppet configuration directory.
138111

139112
#### config
140113
Type | Default | Puppet Version(s)
141114
------ | ---------------------- | ------------------
142-
String | Puppet's default value | 2.x, 3.x, 4.x, 5.x
115+
String | Puppet's default value | any
143116

144117
The path to `puppet.conf`.
145118

146-
#### manifest
147-
Type | Default | Puppet Version(s)
148-
------ | ---------------------- | -----------------
149-
String | Puppet's default value | 2.x, 3.x
150-
151-
The entry-point manifest for Puppet, usually `$manifest_dir/site.pp`.
152-
153-
#### template\_dir
154-
Type | Default | Puppet Version(s)
155-
------ | ------- | -----------------
156-
String | `nil` | 2.x, 3.x
157-
158-
The path to the directory that Puppet should search for templates that are
159-
stored outside of modules.
160-
161119
#### environmentpath
162120
Type | Default | Puppet Version(s)
163121
------ | ------------------------------------- | -----------------
164-
String | `"/etc/puppetlabs/code/environments"` | 4.x, 5.x
122+
String | `"/etc/puppetlabs/code/environments"` | any
165123

166124
The search path for environment directories.
167125

168-
#### parser
169-
Type | Default | Puppet Version(s)
170-
------ | ----------- | -----------------
171-
String | `"current"` | >= 3.2
172-
173-
This switches between the 3.x (`current`) and 4.x (`future`) parsers.
174-
175-
#### ordering
176-
Type | Default | Puppet Version(s)
177-
------ | -------------- | -----------------
178-
String | `"title-hash"` | >= 3.3, 4.x, 5.x
179-
180-
How unrelated resources should be ordered when applying a catalogue.
181-
* `manifest` - Use the order in which the resources are declared in the
182-
manifest.
183-
* `title-hash` - Order the resources randomly, but in a consistent manner
184-
across runs (the order will only change if the manifest changes).
185-
* `random` - Order the resources randomly.
186-
187126
#### strict\_variables
188127
Type | Default | Puppet Version(s)
189128
------- | ------- | -----------------
190-
Boolean | `false` | >= 3.5, 4.x, 5.x
129+
Boolean | `false` | any
191130

192131
Makes Puppet raise an error when it tries to reference a variable that hasn't
193132
been defined (not including variables that have been explicitly set to
@@ -196,15 +135,15 @@ been defined (not including variables that have been explicitly set to
196135
#### stringify\_facts
197136
Type | Default | Puppet Version(s)
198137
------- | ------- | -----------------
199-
Boolean | `true` | >= 3.3, 4.x, 5.x
138+
Boolean | `true` | any
200139

201140
Makes rspec-puppet coerce all the fact values into strings (matching the
202141
behaviour of older versions of Puppet).
203142

204143
#### enable\_pathname\_stubbing
205144
Type | Default | Puppet Version(s)
206145
------- | ------- | ------------------
207-
Boolean |`false` | 2.x, 3.x, 4.x, 5.x
146+
Boolean |`false` | any
208147

209148
Configures rspec-puppet to stub out `Pathname#absolute?` with it's own
210149
implementation. This should only be enabled if you're running into an issue
@@ -214,15 +153,15 @@ functions, etc) that use `Pathname#absolute?`.
214153
#### setup\_fixtures
215154
Type | Default | Puppet Version(s)
216155
------- | ------- | ------------------
217-
Boolean | `true` | 2.x, 3.x, 4.x, 5.x
156+
Boolean | `true` | any
218157

219158
Configures rspec-puppet to automatically create a link from the root of your
220159
module to `spec/fixtures/<module name>` at the beginning of the test run.
221160

222161
#### derive\_node\_facts\_from\_nodename
223162
Type | Default | Puppet Version(s)
224163
------- | ------- | -----------------
225-
Boolean | `true` | 2.x, 3.x, 4.x, 5.x
164+
Boolean | `true` | any
226165

227166
If `true`, rspec-puppet will override the `fdqn`, `hostname`, and `domain`
228167
facts with values that it derives from the node name (specified with
@@ -235,7 +174,7 @@ setting to `false`.
235174
#### facter\_implementation
236175
Type | Default | Puppet Version(s)
237176
------- | -------- | -----------------
238-
String | `facter` | 6.25+, 7.12+
177+
String | `facter` | any
239178

240179
Configures rspec-puppet to use a specific Facter implementation for running
241180
unit tests. If the `rspec` implementation is set and Puppet does not support
@@ -699,8 +638,6 @@ RSpec.configure do |c|
699638
end
700639
```
701640

702-
**NOTE** Setting top-scope variables is not supported in Puppet < 3.0.
703-
704641
#### Specifying extra code to load (pre-conditions)
705642

706643
If the manifest being tested relies on another class or variables to be set, these can be added via
@@ -752,7 +689,7 @@ let(:module_path) { '/path/to/your/module/dir' }
752689

753690
#### Specifying trusted facts
754691

755-
When testing with Puppet >= 4.3 the trusted facts hash will have the standard trusted fact keys
692+
The trusted facts hash will have the standard trusted fact keys
756693
(certname, domain, and hostname) populated based on the node name (as set with `:node`).
757694

758695
By default, the test environment contains no custom trusted facts (as usually obtained
@@ -777,8 +714,7 @@ end
777714

778715
#### Specifying trusted external data
779716

780-
When testing with Puppet >= 6.14, the trusted facts hash will have an additional `external`
781-
key for trusted external data.
717+
The trusted facts hash will have an `external` key for trusted external data.
782718

783719
By default, the test environment contains no trusted external data (as usually obtained from
784720
trusted external commands and found in the `external` key). If you need to test against specific

0 commit comments

Comments
 (0)