pdqtest 1.9.9beta7 → 1.9.9beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -10
- data/doc/acceptance_tests.md +80 -44
- data/doc/caching.md +6 -4
- data/doc/development.md +18 -5
- data/doc/emoji.md +8 -8
- data/doc/enabling_testing.md +33 -9
- data/doc/hiera.md +9 -7
- data/doc/installation.md +14 -2
- data/doc/pdk.md +101 -120
- data/doc/puppet_facts.md +4 -23
- data/doc/puppet_module_dependencies.md +4 -9
- data/doc/running_tests.md +29 -21
- data/doc/test_generation.md +11 -1
- data/doc/tips_and_tricks.md +8 -5
- data/doc/troubleshooting.md +9 -8
- data/doc/upgrade_1_2.md +181 -48
- data/doc/upgrading.md +27 -117
- data/doc/windows.md +6 -9
- data/lib/pdqtest/docker.rb +1 -1
- data/lib/pdqtest/skeleton.rb +4 -0
- data/lib/pdqtest/version.rb +1 -1
- metadata +2 -2
data/doc/pdk.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# PDK Integration
|
2
2
|
|
3
|
-
First off, what is PDK? PDK is Puppet's
|
4
|
-
interested in right now are:
|
3
|
+
First off, what is PDK? [PDK](https://github.com/puppetlabs/pdk/) is Puppet's
|
4
|
+
development kit. The bits we are interested in right now are:
|
5
5
|
* Validation `pdk validate...`
|
6
6
|
* Testing `pdk test...`
|
7
7
|
* Packaging `pdk build...`
|
@@ -34,8 +34,8 @@ VMs in order to extract maximum speed. It offers a different approach to
|
|
34
34
|
* Complex OS commands that need to report different state between puppet
|
35
35
|
runs can be mocked with Python and a small SQLite database or simple
|
36
36
|
text files (eg the `sysctl` command)
|
37
|
-
* Fake different Unix-like Operating Systems
|
38
|
-
commands that your puppet code would
|
37
|
+
* Fake different Unix-like Operating Systems such as AIX by subverting the
|
38
|
+
commands that your puppet code would execute. This is particularly
|
39
39
|
useful in this case since there are no AIX desktop virtualisation
|
40
40
|
solutions right now and there probably never will be
|
41
41
|
* See [examples](examples.md) for real-world modules using these
|
@@ -52,7 +52,7 @@ for and you should look towards solutions like Beaker or
|
|
52
52
|
|
53
53
|
## How does PDQTest work with PDK? Do I have to choose?
|
54
54
|
|
55
|
-
No you don't have to choose! PDQTest integrates with PDK by making the minimal
|
55
|
+
No, you don't have to choose! PDQTest integrates with PDK by making the minimal
|
56
56
|
amount of invasive changes:
|
57
57
|
|
58
58
|
### New projects
|
@@ -68,12 +68,15 @@ After running `pdqtest init`, run `pdk update` to have PDK process the
|
|
68
68
|
|
69
69
|
### Existing PDQTest projects
|
70
70
|
To make upgrading to PDQTest 2.0 + PDK easy for our existing users, we automate
|
71
|
-
the workflow normally carried out by `pdk convert
|
71
|
+
the workflow normally carried out by `pdk convert`.
|
72
72
|
|
73
73
|
We do not include the entire set of files that would have been generated by
|
74
74
|
`pdk convert` or `pdk new module`. If you want the full set, you should run
|
75
|
-
one of these commands yourself before `pdqtest init` and
|
76
|
-
unless PDK starts writing new files that we are already
|
75
|
+
one of these commands yourself before `pdqtest init` and the resulting files
|
76
|
+
will be left alone unless PDK starts writing new files that we are already
|
77
|
+
using.
|
78
|
+
|
79
|
+
#### Key integration points
|
77
80
|
|
78
81
|
**metadata.json**
|
79
82
|
|
@@ -131,17 +134,22 @@ or supported.
|
|
131
134
|
|
132
135
|
|
133
136
|
### PDQTest directory structure
|
134
|
-
|
137
|
+
* 🛠 - File generated by PDK
|
138
|
+
* ⚡ - File updated/replaced when you run `pdqtest upgrade`:
|
135
139
|
|
136
140
|
```
|
137
|
-
├── bitbucket-pipelines.yml
|
141
|
+
├── bitbucket-pipelines.yml ⚡
|
138
142
|
├── Gemfile 🛠
|
139
143
|
├── Gemfile.local
|
140
144
|
├── Gemfile.project
|
145
|
+
├── .gitattributes 🛠
|
141
146
|
├── .gitignore 🛠
|
142
|
-
├── Makefile
|
143
|
-
├── make.ps1
|
147
|
+
├── Makefile ⚡
|
148
|
+
├── make.ps1 ⚡
|
144
149
|
├── .pdkignore 🛠
|
150
|
+
├── .pdqtest
|
151
|
+
│ ├── Gemfile ⚡
|
152
|
+
│ └── Gemfile.lock
|
145
153
|
├── .puppet-lint.rc
|
146
154
|
├── Rakefile 🛠
|
147
155
|
├── spec
|
@@ -151,10 +159,10 @@ These are the files installed, files marked 🛠 are generated by PDK:
|
|
151
159
|
│ │ │ └── test.yaml
|
152
160
|
│ │ └── hiera.yaml
|
153
161
|
│ └── spec_helper.rb 🛠
|
154
|
-
└── .travis.yml
|
162
|
+
└── .travis.yml ⚡
|
155
163
|
```
|
156
164
|
|
157
|
-
|
165
|
+
Notes:
|
158
166
|
* `.travis.yml` - Complete test suite for Linux modules
|
159
167
|
* `bitbucket-pipelines.yaml` - logical testing only (unit/RSpec)
|
160
168
|
* `.puppet-lint.rc` - Make lint errors test failures, ignore double quotes, etc
|
@@ -162,119 +170,103 @@ The remaining files are specific to PDQTest - notably:
|
|
162
170
|
* `make.ps1` - Essential launch script for Windows
|
163
171
|
* `spec/fixtures/hiera.yaml` - Mock system-wide `hiera.yaml` file
|
164
172
|
* `spec/fixtures/hieradata/test.yaml` - Mock system-wide hieradata
|
165
|
-
* `Gemfile.project` - Used to enable
|
173
|
+
* `Gemfile.project` - Used to enable additional gems in PDK if needed (eg for
|
174
|
+
RSpec)
|
166
175
|
* `Gemfile.local` - Transient file created at runtime by `Makefile` or
|
167
|
-
`make.ps1` to enable
|
168
|
-
point, see details below
|
176
|
+
`make.ps1` to enable additional PDK gems see details below
|
169
177
|
* `.gitignore` - PDK has a massive list of files to ignore for new projects so
|
170
|
-
these are imported
|
171
|
-
|
178
|
+
these are imported and we add some of our own
|
179
|
+
* `.gitattributes` - PDK doesn't process this on `pdk update` so it ignores our
|
180
|
+
`.sync.yml` customisations. This is handy to force LF for teams working on
|
181
|
+
windows
|
182
|
+
* `.pdqtest/Gemfile` - it's **impossible** to share a `Gemfile` with PDK
|
183
|
+
(believe me I tried) Therefore we need our own and it lives here. See details
|
184
|
+
below.
|
185
|
+
* `.pdqtest/Gemfile.lock` - corresponding lock for PDQTest
|
172
186
|
|
173
187
|
## Why are the launch scripts essential/How does the PDQTest gem load itself?
|
188
|
+
|
189
|
+
### Extra gems for `pdk` command
|
174
190
|
PDK provides its own `Gemfile` to select the gems available at runtime. There
|
175
191
|
are hooks in this file to load additional configuration from two locations:
|
176
192
|
* `~/.gemfile`
|
177
193
|
* `YOUR_PROJECT/Gemfile.local`
|
178
194
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
195
|
+
These are good for loading additional GEMs that run inside the PDK ruby
|
196
|
+
environment created by the `pdk` command _only_! PDK modifies it's `Gemfile` at
|
197
|
+
runtime according to the target being run and this which makes it unsafe for us
|
198
|
+
to load the `pdqtest` gem here, because the bundle will change while it is being
|
199
|
+
used.
|
184
200
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
since we are not yet in the bundle.
|
201
|
+
Using `pdk bundle exec` as basically an alias for `bundle exec` did not work as
|
202
|
+
PDQTest needs to call the `pdk` command for its lifecycle targets. This caused
|
203
|
+
serious errors on Windows.
|
189
204
|
|
190
|
-
|
191
|
-
|
205
|
+
We are not supposed to store permanent data in `Gemfile.local` as its in
|
206
|
+
PDK's generated `.gitignore`. The workaround to this is for us to create our own
|
207
|
+
per-project `Gemfile` with the gems we would have liked to have put in
|
208
|
+
`Gemfile.local` and copy/symlink as required.
|
209
|
+
|
210
|
+
The main use of this is to load additional gems during the `pdk test unit` phase
|
211
|
+
that without customising via `.sync.yml` or a custom template repository
|
212
|
+
(although these should work too/instead).
|
192
213
|
|
193
214
|
For further background see:
|
194
215
|
* [PDK-1177](https://tickets.puppetlabs.com/browse/PDK-1177) and
|
195
216
|
* [#50](https://github.com/declarativesystems/pdqtest/issues/50)
|
196
217
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
218
|
+
### Load PDQTest and supporting gems
|
219
|
+
Since PDK updates `Gemfile` during execution, the only sensible option for
|
220
|
+
loading PDQTest is to have our own directory containing our own `Gemfile`
|
221
|
+
and `Gemfile.lock`:
|
222
|
+
* `.pdqtest/Gemfile`
|
223
|
+
* `.pdqtest/Gemfile.lock`
|
224
|
+
|
225
|
+
This affords complete separation from PDK and lets us use the provided ruby. The
|
226
|
+
only caveat is that we must `cd` into the `.pdqtest` directory before executing
|
227
|
+
the `pdqtest` command.
|
228
|
+
|
229
|
+
When you run `pdqtest upgrade`, it will update `.pdqtest/Gemfile` with the newer
|
230
|
+
version of the `pdqtest` gem.
|
231
|
+
|
232
|
+
As ever, the per-project `.pdqtest/Gemfile` means that we support side-by-side
|
233
|
+
installation of all versions of PDQTest while letting PDK take over the main
|
234
|
+
`Gemfile` ensures full PDK compatibility.
|
235
|
+
|
236
|
+
### `Makefile` and `make.ps1`
|
237
|
+
To support these two scenarios, `Makefile` and `make.ps1` automate the project
|
238
|
+
preparation (bundling/symlinking) by providing the following targets:
|
239
|
+
* `Gemfile.local`:
|
240
|
+
* Windows: Copy `Gemfile.project` to `Gemfile.local`, replacing any content,
|
241
|
+
then run `pdk bundle` to update PDKs gems
|
242
|
+
* Linux: Symlink `Gemfile.local` to `Gemfile.project`, then run `pdk bundle`
|
243
|
+
to update PDKs gems
|
244
|
+
* `pdqtestbundle` - run `bundle install` using system/custom ruby against
|
245
|
+
`.pdqtest/Gemfile`
|
246
|
+
* `pdkbundle` - run `pdk bundle install` to re-bundle PDK
|
247
|
+
|
248
|
+
The remaining targets all work by jumping into the `.pdqtest` directory and then
|
249
|
+
using `.pdqtest/Gemfile` to launch `pdqtest`. This avoids users having to jump
|
250
|
+
around the project directories to get work done.
|
204
251
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
Run `bundle install` to install missing gems.
|
209
|
-
```
|
252
|
+
For this reason, you **must** launch PDQTest using the provided `Makefile` or
|
253
|
+
`make.ps1` scripts, at until your familiar with jumping to the `.pdqtest`
|
254
|
+
directory to run `bundle exec pdqtest` yourself.
|
210
255
|
|
211
|
-
There seems no other way to fix this other than building the development gem
|
212
|
-
with a version matching an existing release. The gem then needs to be installed
|
213
|
-
using `gem install ...` and it will then magically start working. Using other
|
214
|
-
gem tricks like setting `:path` will appear to work but fail when `bundle exec`
|
215
|
-
is called. The other approach of trying to run everything with
|
216
|
-
`pdk bundle exec pdqtest` fails with various errors depending what platform your
|
217
|
-
on, presumably because `pdqtest` runs `pdk` command as part of its tests.
|
218
|
-
|
219
|
-
The final final caveat of this approach is that the PDQTest gem dependencies are
|
220
|
-
pinned at whatever the _real_ release uses, so if any were changed or added they
|
221
|
-
need to be temporarily added to `Gemfile.project`
|
222
|
-
|
223
|
-
The above works on Linux... For windows there is also the situation where:
|
224
|
-
* PDK vendors its own gems that magically appear
|
225
|
-
* PDK can only use "published" gems(specs?) it downloads - or appears to
|
226
|
-
* when you go to `bundle install` without using PDK you blow up the lock
|
227
|
-
file
|
228
|
-
* When you `bundle exec pdqtest` you get the above error because _something_
|
229
|
-
uses the old one `gemspec`
|
230
|
-
* The answer seems to be:
|
231
|
-
1. use `gem 'pdqtest', :path=>'c:/vagrant/pdqtest'` in `Gemfile.local`
|
232
|
-
2. `pdk bundle install`
|
233
|
-
3. `bundle update pdqtest` - yes even though your not supposed to...
|
234
|
-
4. `bundle exec pdqtest` - now it should work... why is beyond me
|
235
|
-
* If you still have errors:
|
236
|
-
1. `bundle install`
|
237
|
-
2. `rm Gemfile.lock`
|
238
|
-
3. `pdk bundle install` - working?
|
239
|
-
|
240
|
-
Somtimes you just have to upload the whole gem file as a pre-release object:
|
241
|
-
* Version set to x.x.xWHATEVER
|
242
|
-
* `gem push pdqtest-x.x.xWHATEVER.gem`
|
243
|
-
* `gem install pdqtest --pre`
|
244
|
-
|
245
|
-
|
246
|
-
If your just want to use PDQTest, you will hopefully never have to worry about
|
247
|
-
this... On the other hand, if this all sounds confusing... That's because it is!
|
248
256
|
|
249
257
|
## What happens when I upgrade PDQTest?
|
250
|
-
When
|
251
|
-
|
252
|
-
|
253
|
-
gem install pdqtest
|
254
|
-
cd /your/project
|
255
|
-
pdqtest upgrade
|
256
|
-
pdk bundle install
|
257
|
-
```
|
258
|
-
|
259
|
-
This updates:
|
260
|
-
* Project gems in `Gemfile.project` (currently `pdqtest` and `puppet-strings`)
|
261
|
-
* Our CI and CLI integrations:
|
262
|
-
* `Makefile`
|
263
|
-
* `make.ps1`
|
264
|
-
* `.travis.yml`
|
265
|
-
* `bitbucket-pipelines.yml`
|
266
|
-
|
267
|
-
The final `pdk bundle install` command upgrades PDK's bundle to the include our
|
268
|
-
update and is critical to making the whole process work.
|
258
|
+
When PDQTest is upgraded, we update the files above marked ⚡ in your project.
|
259
|
+
This doesn't impact PDK at all with the exception that we take over
|
260
|
+
`.travis.yml` since the PDK one doesn't do what we want it to.
|
269
261
|
|
270
262
|
## What happens when I upgrade PDK?
|
271
263
|
PDK operates independently from PDQTest and maintains its own files. Your free
|
272
264
|
to run `pdk update` to upgrade the your files to the latest PDK templated ones
|
273
|
-
|
265
|
+
whenever you like.
|
274
266
|
|
275
267
|
To protect PDQTest files from alteration (notably `.travis.yml` and
|
276
|
-
`bitbucket-pipelines.yml`) we merge
|
277
|
-
prevent churn.
|
268
|
+
`bitbucket-pipelines.yml`) we merge instructions to have PDK leave them alone
|
269
|
+
to `.sync.yml` (merging with any existing rules) to prevent churn.
|
278
270
|
|
279
271
|
If you have further customisations to PDK controlled files your options are:
|
280
272
|
* Use git to revert any change by PDK
|
@@ -290,27 +282,21 @@ open a [ticket](https://github.com/declarativesystems/pdqtest/issues)
|
|
290
282
|
|
291
283
|
## How do PDQTest lifecycle tests relate to PDK?
|
292
284
|
|
293
|
-
| PDQTest | PDK
|
294
|
-
| --- | ---
|
295
|
-
| `
|
296
|
-
| `
|
297
|
-
| `
|
298
|
-
|
299
|
-
* Previous `lint` subcommand was removed in PDQTest 2.0 as its now covered by
|
300
|
-
`syntax`
|
285
|
+
| PDQTest | PDK |
|
286
|
+
| --- | --- |
|
287
|
+
| `logical` | `pdk validate metadata,puppet`, `pdk test unit` |
|
288
|
+
| `all` | `pdk validate metadata,puppet`, `pdk test unit`, `pdk build --force` |
|
289
|
+
| `fast` | N/A - run `puppet-lint` and `rake syntax` to finish faster |
|
301
290
|
|
302
291
|
## What actually happens when I run PDQTest?
|
303
292
|
|
304
293
|
`bundle exec pdqtest all` is the default target executed by `make` and
|
305
|
-
`.\make.ps1`.
|
306
|
-
or run individual parts. The complete run looks like this:
|
294
|
+
`.\make.ps1`. The complete run looks like this:
|
307
295
|
|
308
296
|
1. `pdk validate 'metadata,puppet'`
|
309
297
|
2. Install modules listed in the `metadata.json` file using R10K against a
|
310
298
|
temporary `Puppetfile` at `Puppetfile.pdqtest`
|
311
299
|
3. Generate a `.fixtures.yml` file based on `metadata.json`
|
312
|
-
Currently impacted by
|
313
|
-
[#47](https://github.com/declarativesystems/pdqtest/issues/47)
|
314
300
|
4. `pdk test unit`
|
315
301
|
5. Run all acceptance tests
|
316
302
|
6. `puppet strings generate --format=markdown` to generate `REFERENCE.md`
|
@@ -320,15 +306,10 @@ At each stage of the process, we output emoji's to keep you informed of
|
|
320
306
|
progress. Any failure prevents running the next phase of testing and lint errors
|
321
307
|
are considered failures.
|
322
308
|
|
323
|
-
### Technical details (code)
|
324
|
-
If anyone knows a better way to do this, I'd love to hear about it:
|
325
|
-
[PDQTest lifecycle](https://github.com/declarativesystems/pdqtest/blob/master/exe/pdqtest)
|
326
|
-
[PDK Wrapper](https://github.com/declarativesystems/pdqtest/blob/master/lib/pdqtest/pdk.rb)
|
327
|
-
|
328
309
|
## PDQTest is pretty slow!
|
329
310
|
This is a side effect of having to shell out to run PDK via system calls.
|
330
|
-
There's really no other way to do this while maintaining full PDK
|
331
|
-
(if you know different, please
|
311
|
+
There's really no other way to do this while maintaining full PDK compatibility
|
312
|
+
(if you know different, please open a ticket and let me know how).
|
332
313
|
|
333
314
|
That said you might just want to run syntax and lint tests and acceptance tests
|
334
315
|
as quick as possible, in which case run:
|
data/doc/puppet_facts.md
CHANGED
@@ -11,11 +11,12 @@ consistent set of facts for both RSpec and acceptance testing, in the file that
|
|
11
11
|
PDK expects them to be in.
|
12
12
|
|
13
13
|
## 🐉 Differences from PDK 🐉
|
14
|
-
The above behaviour is
|
15
|
-
mechanism is supposed to be used for acceptance tests
|
14
|
+
The above behaviour is _not_ how PDK intends this file to be used as some other
|
15
|
+
mechanism is supposed to be used for acceptance tests.
|
16
16
|
|
17
17
|
It's pretty rare to actually need `spec/default_facts.yml` unless your doing
|
18
|
-
unit testing since you can insert custom facts as part of your test setup
|
18
|
+
unit testing since you can insert custom facts as part of your test setup
|
19
|
+
script (eg `spec/fixtures/init__setup.sh`).
|
19
20
|
|
20
21
|
Be aware that PDK sets a few facts to specific values that we will pick up and
|
21
22
|
use in your acceptance tests:
|
@@ -30,23 +31,3 @@ macaddress: "AA:AA:AA:AA:AA:AA"
|
|
30
31
|
You would need to use a forked version of the PDK templates to fix these
|
31
32
|
properly, but your using the structured facts anyway so it makes no difference,
|
32
33
|
right...?
|
33
|
-
|
34
|
-
## Older versions
|
35
|
-
PDQTest < 2.0 includes built-in
|
36
|
-
[factsets](https://github.com/declarativesystems/puppet_factset) covering many
|
37
|
-
common operating systems, however, sometimes additional facts are needed
|
38
|
-
throughout a module to mock an external fact or custom fact from a different
|
39
|
-
module that is expected to be some known value. In this case, creating the
|
40
|
-
directory:
|
41
|
-
|
42
|
-
```
|
43
|
-
spec/merge_facts
|
44
|
-
```
|
45
|
-
|
46
|
-
Inside the module being tested will result in all JSON files contained being
|
47
|
-
merged into all OS specific factsets used for testing as generated by
|
48
|
-
`pdqtest generate_rspec`.
|
49
|
-
|
50
|
-
To put it simply, drop `.json` file(s) in this directory to add them to every
|
51
|
-
factset. These facts will be made automatically avaialable to facter when
|
52
|
-
running acceptance testing
|
@@ -32,16 +32,11 @@ fixtures:
|
|
32
32
|
```
|
33
33
|
|
34
34
|
It is an error to define the same module in both `metadata.json` and
|
35
|
-
`.fixtures.yml` and the results of doing
|
35
|
+
`.fixtures.yml` and the results of doing so are undefined:
|
36
36
|
* Always use `metadata.json` for public forge modules and we will update
|
37
37
|
`.fixtures.yml` based on it
|
38
38
|
* Modules from git should _only_ be defined in `.fixtures.yml`
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
* Previous versions of pdqtest configured the r10k cache via `.r10k.yaml` which
|
44
|
-
caused [#44](https://github.com/declarativesystems/pdqtest/issues/44). To fix
|
45
|
-
this, we now use the default r10k cache dir at `~/.r10k/cache` and don't write
|
46
|
-
`.r10k.yaml` any more. You should remove any `.r10k.yaml` files from your
|
47
|
-
project unless you need it for something specific.
|
40
|
+
### pdk build
|
41
|
+
Note that running `pdk build` will remove any modules present under
|
42
|
+
`/spec/fixtures/modules`. Run unit tests to restore them.
|
data/doc/running_tests.md
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
## Important
|
4
4
|
You **must** use the provided launch scripts `Makefile` or `make.ps1` to run
|
5
|
-
PDQTest, at least
|
6
|
-
|
5
|
+
PDQTest, at least until your familiar with how PDQTest works. This is because
|
6
|
+
PDQTest must always be run from the `.pdqtest` directory. See
|
7
|
+
[PDK integration](pdk.md) for more information.
|
7
8
|
|
8
9
|
## Quickstart
|
9
10
|
If you just want to run all tests:
|
@@ -18,41 +19,48 @@ make
|
|
18
19
|
.\make.ps1
|
19
20
|
```
|
20
21
|
|
21
|
-
|
22
|
-
target
|
22
|
+
## Make targets
|
23
|
+
Alternatively, you can choose to run a `Makefile`/`make.ps1` target by supplying
|
24
|
+
an argument from this table:
|
23
25
|
|
24
|
-
| Target
|
25
|
-
| ---
|
26
|
-
| all |
|
27
|
-
| fast | lint,
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
| Target | Description | PDK compatible? |
|
27
|
+
| --- | --- | --- |
|
28
|
+
| `all` | metadata, syntax, lint, rspec, acceptance, strings, build | yes |
|
29
|
+
| `fast` | syntax, lint, rspec, acceptance, strings | no |
|
30
|
+
| `acceptance` | acceptance tests only | - |
|
31
|
+
| `shell` | run acceptance tests and print command to get a shell in the container | yes |
|
32
|
+
| `setup` | download required docker images for this version of PDQTest | - |
|
33
|
+
| `shellnopuppet` | open a shell in the test container | yes |
|
34
|
+
| `logical` | metadata, syntax, lint, rspec, docs | yes |
|
35
|
+
| `pdqtestbundle` | install gems needed for PDQTest | - |
|
36
|
+
| `docs` | generate `REFERENCE.md` using Puppet Strings | - |
|
37
|
+
| `Gemfile.local` | symlink/copy `Gemfile.local` from `Gemfile.project` and re-bundle PDK | yes |
|
38
|
+
| `pdkbundle` | re-bundle PDK | yes |
|
39
|
+
| `clean` | cleanup `/pkg` and `/spec/fixtures/modules` | - |
|
31
40
|
|
32
|
-
|
41
|
+
**PDK compatible**
|
42
|
+
* yes: we run the `pdk` command for this part of the lifecycle
|
43
|
+
* no: we run an alternative command
|
44
|
+
* -: There is no corresponding `pdk` command
|
33
45
|
|
46
|
+
**Examples**
|
34
47
|
|
35
|
-
|
48
|
+
Test the module as quickly as possible:
|
36
49
|
|
37
|
-
|
50
|
+
*Linux*
|
38
51
|
```shell
|
39
52
|
make fast
|
40
53
|
```
|
41
54
|
|
42
|
-
|
55
|
+
*Windows*
|
43
56
|
```shell
|
44
57
|
.\make.ps1 fast
|
45
58
|
```
|
46
59
|
|
47
|
-
## Only run acceptance tests
|
48
|
-
```shell
|
49
|
-
bundle exec pdqtest acceptance
|
50
|
-
```
|
51
|
-
|
52
60
|
|
53
61
|
## See also
|
54
62
|
|
55
63
|
PDQTest help:
|
56
64
|
```shell
|
57
|
-
bundle exec pdqtest --help
|
65
|
+
cd .pdqtest ; bundle exec pdqtest --help
|
58
66
|
```
|
data/doc/test_generation.md
CHANGED
@@ -23,4 +23,14 @@ This will also create examples/mynewthing.pp if you haven't created it yet.
|
|
23
23
|
|
24
24
|
## RSpec tests
|
25
25
|
PDQTest < 2.0 includes rspec test generation. This functionality is replaced by
|
26
|
-
PDK in later versions
|
26
|
+
PDK in later versions:
|
27
|
+
|
28
|
+
```shell
|
29
|
+
pdk new class
|
30
|
+
```
|
31
|
+
|
32
|
+
Generates Puppet classes _and_ RSpec tests
|
33
|
+
|
34
|
+
## Other files
|
35
|
+
You should investigate PDK for generating more boiler plate code for things like
|
36
|
+
types/providers, defined resources, etc.
|
data/doc/tips_and_tricks.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Tips and tricks
|
2
2
|
* You can put any puppet code you like (including an empty file...) in each of
|
3
|
-
the files under `/examples` and it will executed with `puppet apply`
|
3
|
+
the files under `/examples` and it will executed with `puppet apply` as long
|
4
|
+
as it contains the magic marker `#@PDQTest` or `#@PDQTestWin`
|
4
5
|
* If you need to test multiple different things (eg different parameters for a
|
5
6
|
new type and provider), you need to create a different (acceptance) testcase
|
6
7
|
for each distinct thing to test
|
@@ -11,14 +12,16 @@
|
|
11
12
|
* To disable tests temporarily for a specific example, remove the magic marker
|
12
13
|
`#@PDQTest` or `#@PDQTestWin` from the example
|
13
14
|
* Nested examples (subdirectories) are not supported at this time
|
14
|
-
* Since
|
15
|
-
before executing tests, they can be used to mock
|
16
|
-
test system:
|
15
|
+
* Since all of the `*__setup.sh`/`*__setup.ps1` scripts are run in the container
|
16
|
+
as `root`/`Administrator` before executing tests, they can be used to mock
|
17
|
+
_almost anything_ in the test system:
|
17
18
|
* Replace system binaries to fake network operations
|
18
19
|
* Add system binaries to simulate other operating systems such as AIX,
|
19
20
|
Solaris, etc
|
20
21
|
* Create/copy files, directories, etc.
|
21
22
|
* Install OS packages
|
22
23
|
* Install python scripts to mock database servers using SQLite... 😉
|
23
|
-
* Files added by PDQTest >= 2.0
|
24
|
+
* Files added by PDQTest >= 2.0 that are not originating from PDK are marked:
|
24
25
|
`*File originally created by PDQTest*`
|
26
|
+
* See [development](development.md) guide for how to turn on debugging and exit
|
27
|
+
stack traces
|
data/doc/troubleshooting.md
CHANGED
@@ -5,16 +5,17 @@
|
|
5
5
|
your in and you are using `rvm` its probably because `rvm` overrides `cd` and
|
6
6
|
does strange things. You can probably turn this off. Alternatively, use
|
7
7
|
`rbenv`
|
8
|
-
* Don't forget to run `
|
9
|
-
download/update the Docker image
|
8
|
+
* Don't forget to run `make setup` or `.\make.ps1 setup` before your first
|
9
|
+
PDQTest run to download/update the Docker image
|
10
10
|
* If you need to access private git repositories, make sure to use
|
11
11
|
`.fixtures.yml` not `fixtures.yml` (changed in 2.0.0)
|
12
12
|
* If you need a private key to access private repositories, set this up for your
|
13
|
-
regular git command/ssh and
|
13
|
+
regular git command/ssh and PDK should reuse the settings
|
14
14
|
* Be sure to annotate the examples you wish to acceptance test with the magic
|
15
15
|
marker comment `#@PDQTest` or `#@PDQTestWin`
|
16
|
-
* Be sure to run `make` or `
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
* Be sure to run `make` or `.\make.ps1` to download dependencies when running
|
17
|
+
acceptance tests. Previous versions (re)downloaded modules as required from
|
18
|
+
inside docker but this step has been replaced with a simple symlink to reduce
|
19
|
+
the amount of downloading so the modules must already be present.
|
20
|
+
* Update to the latest PDK before running PDQTest
|
21
|
+
* See the [PDQTest 1.x -> 2.x upgrade notes](upgrade_1_2.md) for other gotchas
|