Skip to content

Commit 316d959

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 d21b570 commit 316d959

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+439
-1083
lines changed

README.md

Lines changed: 30 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,17 @@
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:
44-
```ruby
45-
# /spec
46-
base_dir = File.dirname(File.expand_path(__FILE__))
4730

31+
```ruby
4832
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')
33+
c.module_path = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'modules')
5234
c.environmentpath = File.join(Dir.pwd, 'spec')
53-
35+
c.manifest = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'manifests', 'site.pp')
5436
# Coverage generation
5537
c.after(:suite) do
5638
RSpec::Puppet::Coverage.report!
@@ -63,131 +45,96 @@ end
6345
rspec-puppet can be configured by modifying the `RSpec.configure` block in your
6446
`spec/spec_helper.rb` file.
6547

66-
```
48+
```ruby
6749
RSpec.configure do |c|
6850
c.<config option> = <value>
6951
end
7052
```
7153

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-
7954
#### module\_path
8055
Type | Default | Puppet Version(s)
8156
------ | -------- | ------------------
82-
String | Required | 2.x, 3.x, 4.x, 5.x
57+
String | Required | any
8358

8459
The path to the directory containing your Puppet modules.
8560

8661
#### default\_facts
8762
Type | Default | Puppet Version(s)
8863
---- | ------- | ------------------
89-
Hash | `{}` | 2.x, 3.x, 4.x, 5.x
64+
Hash | `{}` | any
9065

9166
A hash of default facts that should be used for all the tests.
9267

9368
#### hiera\_config
9469
Type | Default | Puppet Version(s)
9570
------ | ------------- | -----------------
96-
String | `"/dev/null"` | 3.x, 4.x, 5.x
71+
String | `"/dev/null"` | any
9772

9873
The path to your `hiera.yaml` file (if used).
9974

75+
#### manifest
76+
Type | Default | Puppet Version(s)
77+
------ | ---------------------- | -----------------
78+
String | Puppet's default value | any
79+
80+
Path to test manifest. Typically `spec/fixtures/manifests/site.pp`.
81+
10082
#### default\_node\_params
10183
Type | Default | Puppet Version(s)
10284
---- | ------- | -----------------
103-
Hash | `{}` | 4.x, 5.x
85+
Hash | `{}` | any
10486

10587
A hash of default node parameters that should be used for all the tests.
10688

10789
#### default\_trusted\_facts
10890
Type | Default | Puppet Version(s)
10991
---- | ------- | -----------------
110-
Hash | `{}` | 4.x, 5.x
92+
Hash | `{}` | any
11193

11294
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`.
95+
(available in the manifests as the `$trusted` hash).
11596

11697
#### trusted\_node\_data
11798
Type | Default | Puppet Version(s)
11899
------- | ------- | -----------------
119-
Boolean | `false` | >=3.4, 4.x, 5.x
100+
Boolean | `false` | any
120101

121102
Configures rspec-puppet to use the `$trusted` hash when compiling the
122103
catalogues.
123104

124105
#### trusted\_server\_facts
125106
Type | Default | Puppet Version(s)
126107
------- | ------- | -----------------
127-
Boolean | `false` | >=4.3, 5.x
108+
Boolean | `false` | any
128109

129110
Configures rspec-puppet to use the `$server_facts` hash when compiling the
130111
catalogues.
131112

132113
#### confdir
133114
Type | Default | Puppet Version(s)
134115
------ | --------------- | ------------------
135-
String | `"/etc/puppet"` | 2.x, 3.x, 4.x, 5.x
116+
String | `"/etc/puppet"` | any
136117

137118
The path to the main Puppet configuration directory.
138119

139120
#### config
140121
Type | Default | Puppet Version(s)
141122
------ | ---------------------- | ------------------
142-
String | Puppet's default value | 2.x, 3.x, 4.x, 5.x
123+
String | Puppet's default value | any
143124

144125
The path to `puppet.conf`.
145126

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-
161127
#### environmentpath
162128
Type | Default | Puppet Version(s)
163129
------ | ------------------------------------- | -----------------
164-
String | `"/etc/puppetlabs/code/environments"` | 4.x, 5.x
130+
String | `"/etc/puppetlabs/code/environments"` | any
165131

166132
The search path for environment directories.
167133

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-
187134
#### strict\_variables
188135
Type | Default | Puppet Version(s)
189136
------- | ------- | -----------------
190-
Boolean | `false` | >= 3.5, 4.x, 5.x
137+
Boolean | `false` | any
191138

192139
Makes Puppet raise an error when it tries to reference a variable that hasn't
193140
been defined (not including variables that have been explicitly set to
@@ -196,15 +143,15 @@ been defined (not including variables that have been explicitly set to
196143
#### stringify\_facts
197144
Type | Default | Puppet Version(s)
198145
------- | ------- | -----------------
199-
Boolean | `true` | >= 3.3, 4.x, 5.x
146+
Boolean | `true` | any
200147

201148
Makes rspec-puppet coerce all the fact values into strings (matching the
202149
behaviour of older versions of Puppet).
203150

204151
#### enable\_pathname\_stubbing
205152
Type | Default | Puppet Version(s)
206153
------- | ------- | ------------------
207-
Boolean |`false` | 2.x, 3.x, 4.x, 5.x
154+
Boolean |`false` | any
208155

209156
Configures rspec-puppet to stub out `Pathname#absolute?` with it's own
210157
implementation. This should only be enabled if you're running into an issue
@@ -214,15 +161,15 @@ functions, etc) that use `Pathname#absolute?`.
214161
#### setup\_fixtures
215162
Type | Default | Puppet Version(s)
216163
------- | ------- | ------------------
217-
Boolean | `true` | 2.x, 3.x, 4.x, 5.x
164+
Boolean | `true` | any
218165

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

222169
#### derive\_node\_facts\_from\_nodename
223170
Type | Default | Puppet Version(s)
224171
------- | ------- | -----------------
225-
Boolean | `true` | 2.x, 3.x, 4.x, 5.x
172+
Boolean | `true` | any
226173

227174
If `true`, rspec-puppet will override the `fdqn`, `hostname`, and `domain`
228175
facts with values that it derives from the node name (specified with
@@ -235,7 +182,7 @@ setting to `false`.
235182
#### facter\_implementation
236183
Type | Default | Puppet Version(s)
237184
------- | -------- | -----------------
238-
String | `facter` | 6.25+, 7.12+
185+
String | `facter` | any
239186

240187
Configures rspec-puppet to use a specific Facter implementation for running
241188
unit tests. If the `rspec` implementation is set and Puppet does not support
@@ -699,8 +646,6 @@ RSpec.configure do |c|
699646
end
700647
```
701648

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

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

753698
#### Specifying trusted facts
754699

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

758703
By default, the test environment contains no custom trusted facts (as usually obtained
@@ -777,8 +722,7 @@ end
777722

778723
#### Specifying trusted external data
779724

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

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

0 commit comments

Comments
 (0)