File: index.md

package info (click to toggle)
ruby-rspec-puppet 2.9.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,416 kB
  • sloc: ruby: 6,661; makefile: 6
file content (261 lines) | stat: -rw-r--r-- 7,801 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
---
layout: base
title: Configuration
icon: fa fa-wrench
breadcrumbs:
    -
        name: Documentation
        path: /documentation/
---
rspec-puppet can be configured by modifying the `RSpec.configure` block in your
`spec/spec_helper.rb` file. If you followed the [setup
instructions](/documentation/setup/) you'll already have an `RSpec.configure`
block that you can modify.

{% highlight ruby %}
RSpec.configure do |c|
  c.<config option> = <value>
end
{% endhighlight %}

## Required settings
### manifest\_dir
**Type:** String<br />
**Puppet Version(s):** 2.x, 3.x

The path to the directory containing your basic manifests like `site.pp`.

### module\_path
**Type:** String<br />
**Puppet Version(s):** 2.x, 3.x, 4.x, 5.x

The path to the directory containing the Puppet modules.

## Useful settings
### default\_facts
**Type:** Hash<br />
**Default:** None<br />
**Puppet Version(s):** 2.x, 3.x, 4.x, 5.x

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

### hiera\_config
**Type:** String<br />
**Default:** `/dev/null`<br />
**Puppet Version(s):** 3.x, 4.x, 5.x

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

### default\_node\_params
**Type:** Hash<br />
**Default:** None<br />
**Puppet Version(s):** 4.x, 5.x

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

### default\_trusted\_facts
**Type:** Hash<br />
**Default:** None<br />
**Puppet Version(s):** 4.x, 5.x

A hash of default trusted facts that should be used for all the tests
(available in the manifests as `$trusted`). In order to use this,
`trusted_node_data` must also be set to `true`.

### trusted\_node\_data
**Type:** Boolean<br />
**Default:** `false`<br />
**Puppet Version(s):** ~> 3.4, 4.x, 5.x

Makes rspec-puppet use the `$trusted` hash when testing catalogues.

### setup\_fixtures
**Type:** Boolean<br />
**Default:** `true`<br />
**Puppet Version(s):** 2.x, 3.x, 4.x, 5.x

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

### trusted\_server\_facts
**Type:** Boolean<br />
**Default:** `false`<br />
**Puppet Version(s):** >= 4.3, 5.x

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

## Optional overrides
Only set these values if you need to. rspec-puppet is generally pretty good at
determining the values itself, but if you need to override them you can.

### confdir
**Type:** String<br />
**Default:** `/etc/puppet`<br />
**Puppet Version(s):** 2.x, 3.x, 4.x, 5.x

The path to the main Puppet configuration directory.

See the [Puppet
documentation](https://docs.puppet.com/puppet/latest/configuration.html#confdir)
for further details.

### config
**Type:** String<br />
**Default:** Puppet's default value<br />
**Puppet Version(s):** 2.x, 3.x, 4.x, 5.x

The path to `puppet.conf`.

See the [Puppet documentation](https://docs.puppet.com/puppet/latest/configuration.html#config)
for further details.

### manifest
**Type:** String<br />
**Default:** Puppet's default value<br />
**Puppet Version(s):** 2.x, 3.x

The entry-point manifest for Puppet, usually `<manifest_dir>/site.pp`.

See the [Puppet
documentation](https://docs.puppet.com/puppet/latest/configuration.html#manifest)
for further details.

### template\_dir
**Type**: String<br />
**Default:** None<br />
**Puppet Version(s):** 2.x, 3.x

The path to the directory that Puppet should search for templates stored
outside of modules.

See the [Puppet
documentation](https://docs.puppet.com/puppet/3.8/deprecated_settings.html#templatedir)
for further details.

### environmentpath
**Type:** String<br />
**Default:** `/etc/puppetlabs/code/environments`<br />
**Puppet Version(s):** 4.x, 5.x

The search path for environment directories.

See the [Puppet
documentation](https://docs.puppet.com/puppet/latest/configuration.html#environmentpath)
for further details.

### parser
**Type:** String<br />
**Default:** `current`<br />
**Puppet Version(s):** ~> 3.2

This switches between the 3.x (`current`) and 4.x (`future`) parsers.

See the [Puppet
documentation](https://docs.puppet.com/puppet/3.8/deprecated_settings.html#parser)
for further details.

### ordering
**Type:** String<br />
**Default:** `title-hash`<br />
**Puppet Version(s):** ~> 3.3, 4.x, 5.x

How unrelated resources should be ordered when applying a catalogue.
 * `manifest` - Use the order in which the resources are declared in the
   manifest.
 * `title-hash` - Order the resources randomly, but in a consistent manner
   across runs (the order will only change if the code changes).
 * `random` - Order the resources randomly (ideal for finding resources that
   do not have explicit dependencies).

See the [Puppet
documentation](https://docs.puppet.com/puppet/latest/configuration.html#ordering)
for further details.

### strict\_variables
**Type:** Boolean<br />
**Default:** `false`<br />
**Puppet Version(s):** ~> 3.5, 4.x, 5.x

Makes Puppet raise an error when it tries to reference a variable that hasn't
been defined (not including variables that have been explicitly set to
`undef`).

### stringify\_facts
**Type:** Boolean<br />
**Default:** `true`<br />
**Puppet Version(s):** ~> 3.3, 4.x, 5.x

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

### enable\_pathname\_stubbing
**Type:** Boolean<br />
**Default:** `false`<br />
**Puppet Version(s):** 2.x, 3.x, 4.x, 5.x

Configures rspec-puppet to stub out `Pathname#absolute?` with its own
implementation. This should only be enabled if you're running into an issue
running cross-platform tests where you have Ruby code (types, providers,
functions, etc) that use `Pathname#absolute?`.

### derive\_node\_facts\_from\_nodename
**Type:** Boolean<br />
**Default:** `true`<br />
**Puppet Version(s):** 2.x, 3.x, 4.x, 5.x

If `true`, rspec-puppet will override the `fdqn`, `hostname`, and `domain`
facts with values that it derives from the node name (specified with
`let(:node)`.

In some circumstances (e.g. where your nodename/certname is not the same as
your FQDN), this behaviour is undesirable and can be disabled by changing this
setting to `false`.

### vendormoduledir
**Type:** String<br />
**Default:** `'/dev/null'` (or `'c:/nul/'` on Windows)
**Puppet Version(s):** 6.x

The path to the directory containing vendored modules. Almost always
unnecessary in a testing environment.

### basemodulepath
**Type:** String<br />
**Default:** `'/dev/null'` (or `'c:/nul/'` on Windows)
**Puppet Version(s):** 6.x

The search path for global modules. Almost always unnecessary in a testing
environment.

### disable_module_hiera
**Type:** Boolean<br />
**Default:** `false`<br />
**Puppet Version(s):** 4.9+, 5.x, 6.x

Enabling this will prevent Puppet from using module-layer Hiera data entirely.
This includes the module being tested as well as any fixture modules.
The end effect is that only Hiera data from the global `:hiera_config` parameter will be used

### fixture_hiera_configs
**Type:** Hash<br />
**Default:** `{}`<br />
**Puppet Version(s):** 4.9+, 5.x, 6.x

A hash of module names and their respective module-layer Hiera config file paths.
This can be used to override the path to the module-layer hiera.yaml

### use_fixture_spec_hiera
**Type:** Boolean<br />
**Default:** `false`<br />
**Puppet Version(s):** 4.9+, 5.x, 6.x

Enabling this will prevent Puppet from using the module-layer Hiera config file and instead search the module spec folder for a file named hiera.yaml.

### fallback_to_default_hiera
**Type:** Boolean<br />
**Default:** `true`<br />
**Puppet Version(s):** 4.9+, 5.x, 6.x

A hash of module names and their respective module-layer Hiera config file paths.
This can be used to override the path to the module-layer hiera.yaml.