onceover 3.16.0 β 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +60 -2
- data/factsets/Ubuntu-18.04-64.json +556 -0
- data/factsets/Windows_Server-2008r2-64.json +1 -0
- data/factsets/Windows_Server-2012r2-64.json +1 -0
- data/factsets/windows-10-64.json +2 -1
- data/features/step_definitions/common.rb +11 -0
- data/features/windows.feature +30 -0
- data/features/{run.feature β zzz_run.feature} +0 -0
- data/lib/onceover/cli/run.rb +1 -0
- data/lib/onceover/controlrepo.rb +29 -33
- data/lib/onceover/runner.rb +15 -5
- data/lib/onceover/testconfig.rb +15 -1
- data/onceover.gemspec +2 -2
- data/spec/fixtures/controlrepos/windows/Gemfile +3 -0
- data/spec/fixtures/controlrepos/windows/Puppetfile +3 -0
- data/spec/fixtures/controlrepos/windows/environment.conf +1 -0
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/acl.pp +12 -0
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/groups.pp +8 -0
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/users.pp +9 -0
- data/spec/fixtures/controlrepos/windows/site/role/manifests/groups.pp +8 -0
- data/spec/fixtures/controlrepos/windows/site/role/manifests/users.pp +9 -0
- data/spec/fixtures/controlrepos/windows/spec/onceover.yaml +24 -0
- data/templates/test_spec.rb.erb +60 -0
- metadata +21 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 994971aad52879b6500defdb15dd34f2959d1ec86112712e3fb9c02f1b25ff27
|
4
|
+
data.tar.gz: 9de0f213683ad7c635f6bde6e233de5c0b7a5a52e9947f8ccf7ae8fdb78b3819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d078f45a54c3ec3df4a76907979c460825ccf5436be101524640f6e523272196564fb138431e7e96c7c67a3b291640f35f1de237edf952083a1e2e494c95bcf3
|
7
|
+
data.tar.gz: edc3120fab568247708a2810fe01074ee6f00c87bf894fa74cdfa3e5478c8a8a21312a60d7f6862b0c615cb377df71eea7506a84aa997a2529c349f0f2b260e7
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
*The gateway drug to automated infrastructure testing with Puppet*
|
4
4
|
|
5
|
-
Onceover is a tool to automatically run basic tests on an entire Puppet controlrepo. It includes automatic parsing of the `Puppetfile`, `environment.conf` and others in order to
|
5
|
+
Onceover is a tool to automatically run basic tests on an entire Puppet controlrepo. It includes automatic parsing of the `Puppetfile`, `environment.conf` and others in order to stop silly mistakes ever reaching your Puppet Master!
|
6
|
+
|
7
|
+
**πΊπ₯³ New in v3.17.1: Heaps more Windows fixes! Windows code is now more likely to compile on Non-Windows.**
|
6
8
|
|
7
9
|
## Table of Contents
|
8
10
|
|
@@ -14,6 +16,7 @@ Onceover is a tool to automatically run basic tests on an entire Puppet controlr
|
|
14
16
|
- [factsets](#factsets)
|
15
17
|
- [Hiera Data](#hiera-data)
|
16
18
|
- [r10k](#r10k)
|
19
|
+
- [r10k Config](#r10k-config)
|
17
20
|
- [Spec testing](#spec-testing)
|
18
21
|
- [Adding your own spec tests](#adding-your-own-spec-tests)
|
19
22
|
- [Using Workarounds](#using-workarounds)
|
@@ -228,13 +231,20 @@ It's important to note that in order to reference a group using the *include/exc
|
|
228
231
|
|
229
232
|
One or many tags that tests in this group should be tagged with. This allows you to run only certain tests using the `--tags` command line parameter. **NOTE:** Custom spec tests will always be run as they are not subject to tags
|
230
233
|
|
234
|
+
**include_spec_files** *Default: [**/*]*
|
235
|
+
|
236
|
+
Glob to select additionnal files to be run during `onceover` spec tests.
|
237
|
+
|
238
|
+
Default is to select all files located in the repo spec directory, usually `spec/`.
|
239
|
+
If you have some RSpec tests that depend on a different RSpec configuration than `onceover` or want, for example, to have a different job in your CI to run your own unit tests, you can use this option to select which spec files to run during `onceover` spec tests.
|
240
|
+
|
231
241
|
### factsets
|
232
242
|
|
233
243
|
This gem comes with a few pre-canned factsets. These are listed under the `nodes` sections of `onceover.yaml` when you run `onceover init`. You can also add your own factsets by putting them in:
|
234
244
|
|
235
245
|
`spec/factsets/*.json`
|
236
246
|
|
237
|
-
Factsets are used by the
|
247
|
+
Factsets are used by the onceover gem to generate spec tests, which compile a given class against a certain set of facts. To create these factsets all we need to do is log onto a real machine that has puppet installed and run:
|
238
248
|
|
239
249
|
`puppet facts`
|
240
250
|
|
@@ -275,6 +285,51 @@ It is also worth noting that any hiera hierarchies that are based on custom fact
|
|
275
285
|
|
276
286
|
### r10k
|
277
287
|
|
288
|
+
Organisations often reference modules from their own git servers in the `Puppetfile`, like this:
|
289
|
+
|
290
|
+
```
|
291
|
+
mod "puppetlabs-apache",
|
292
|
+
:git => "https://git.megacorp.com/pup/puppetlabs-apache.git",
|
293
|
+
:tag => "v5.4.0"
|
294
|
+
```
|
295
|
+
|
296
|
+
Under the hood, Onceover uses r10k to download the modules in your `Puppetfile`. If you get errors downloading modules from Git, its because `r10k`'s call to your underlying `git` command has failed. Onceover tells you the command that `r10k` tried to run, so if you get an error like this:
|
297
|
+
|
298
|
+
```
|
299
|
+
INFO -> Updating module /Users/dylan/control-repo/.onceover/etc/puppetlabs/code/environments
|
300
|
+
/production/modules/apache
|
301
|
+
ERROR -> Command exited with non-zero exit code:
|
302
|
+
Command: git --git-dir /Users/dylan/.r10k/git/ssh---git.megacorp.com-pup-puppetlabs_apache.git fetch origin --prune
|
303
|
+
Stderr:
|
304
|
+
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
|
305
|
+
Host key verification failed.
|
306
|
+
|
307
|
+
fatal: Could not read from remote repository.
|
308
|
+
|
309
|
+
Please make sure you have the correct access rights
|
310
|
+
and the repository exists.
|
311
|
+
Exit code: 128
|
312
|
+
```
|
313
|
+
|
314
|
+
Then the approach to debug it would be to run the command that Onceover suggested:
|
315
|
+
|
316
|
+
```
|
317
|
+
git --git-dir /Users/dylan/.r10k/git/ssh---git.megacorp.com-pup-puppetlabs_apache.git fetch origin --prune
|
318
|
+
```
|
319
|
+
|
320
|
+
In this case, running the command interactively gives us a prompt to add the server to our `~/.ssh/known_hosts` file, which fixes the problem permanently:
|
321
|
+
|
322
|
+
```
|
323
|
+
$ git --git-dir /Users/dylan/.r10k/git/ssh---git.megacorp.com-pup-puppetlabs_apache.git fetch origin --prune
|
324
|
+
The authenticity of host 'git.megacorp.com (123.456.789.101)' can't be established.
|
325
|
+
...
|
326
|
+
Warning: Permanently added 'git.megacorp.com,123.456.789.101' (RSA) to the list of known hosts.
|
327
|
+
```
|
328
|
+
|
329
|
+
The other way to resolve this would have been to install the `ssh_askpass` program, but this can spam the screen with modal dialogs on some platforms.
|
330
|
+
|
331
|
+
#### r10k Config
|
332
|
+
|
278
333
|
If you have custom r10k config that you want to use, place the `r10k.yaml` file in one of the following locations:
|
279
334
|
|
280
335
|
- `{repo root}/r10k.yaml`
|
@@ -652,4 +707,7 @@ Cheers to all of those who helped out:
|
|
652
707
|
- @raphink
|
653
708
|
- @tequeter
|
654
709
|
- @alexjfisher
|
710
|
+
- @smortex
|
711
|
+
- @16c7x
|
712
|
+
- @neomilium
|
655
713
|
|
@@ -0,0 +1,556 @@
|
|
1
|
+
{
|
2
|
+
"name": "ubuntu-bionic.lan.asio",
|
3
|
+
"values": {
|
4
|
+
"aio_agent_version": "6.14.0",
|
5
|
+
"architecture": "amd64",
|
6
|
+
"augeas": {
|
7
|
+
"version": "1.12.0"
|
8
|
+
},
|
9
|
+
"augeasversion": "1.12.0",
|
10
|
+
"bios_release_date": "12/01/2006",
|
11
|
+
"bios_vendor": "innotek GmbH",
|
12
|
+
"bios_version": "VirtualBox",
|
13
|
+
"blockdevice_sda_model": "HARDDISK",
|
14
|
+
"blockdevice_sda_size": 10737418240,
|
15
|
+
"blockdevice_sda_vendor": "VBOX",
|
16
|
+
"blockdevice_sdb_model": "HARDDISK",
|
17
|
+
"blockdevice_sdb_size": 10485760,
|
18
|
+
"blockdevice_sdb_vendor": "VBOX",
|
19
|
+
"blockdevices": "sdb,sda",
|
20
|
+
"boardmanufacturer": "Oracle Corporation",
|
21
|
+
"boardproductname": "VirtualBox",
|
22
|
+
"boardserialnumber": "0",
|
23
|
+
"chassistype": "Other",
|
24
|
+
"dhcp_servers": {
|
25
|
+
"enp0s3": "10.0.2.2",
|
26
|
+
"system": "10.0.2.2"
|
27
|
+
},
|
28
|
+
"disks": {
|
29
|
+
"sda": {
|
30
|
+
"model": "HARDDISK",
|
31
|
+
"size": "10.00 GiB",
|
32
|
+
"size_bytes": 10737418240,
|
33
|
+
"vendor": "VBOX"
|
34
|
+
},
|
35
|
+
"sdb": {
|
36
|
+
"model": "HARDDISK",
|
37
|
+
"size": "10.00 MiB",
|
38
|
+
"size_bytes": 10485760,
|
39
|
+
"vendor": "VBOX"
|
40
|
+
}
|
41
|
+
},
|
42
|
+
"dmi": {
|
43
|
+
"bios": {
|
44
|
+
"release_date": "12/01/2006",
|
45
|
+
"vendor": "innotek GmbH",
|
46
|
+
"version": "VirtualBox"
|
47
|
+
},
|
48
|
+
"board": {
|
49
|
+
"manufacturer": "Oracle Corporation",
|
50
|
+
"product": "VirtualBox",
|
51
|
+
"serial_number": "0"
|
52
|
+
},
|
53
|
+
"chassis": {
|
54
|
+
"type": "Other"
|
55
|
+
},
|
56
|
+
"manufacturer": "innotek GmbH",
|
57
|
+
"product": {
|
58
|
+
"name": "VirtualBox",
|
59
|
+
"serial_number": "0",
|
60
|
+
"uuid": "2C7D24ED-FB7D-4B4C-BC4B-B9FC32C8BDC3"
|
61
|
+
}
|
62
|
+
},
|
63
|
+
"domain": "lan.asio",
|
64
|
+
"facterversion": "3.14.9",
|
65
|
+
"filesystems": "btrfs,ext2,ext3,ext4,iso9660,squashfs,vfat",
|
66
|
+
"fips_enabled": false,
|
67
|
+
"fqdn": "ubuntu-bionic.lan.asio",
|
68
|
+
"gid": "root",
|
69
|
+
"hardwareisa": "x86_64",
|
70
|
+
"hardwaremodel": "x86_64",
|
71
|
+
"hostname": "ubuntu-bionic",
|
72
|
+
"hypervisors": {
|
73
|
+
"virtualbox": {
|
74
|
+
"revision": "133895",
|
75
|
+
"version": "6.0.14"
|
76
|
+
}
|
77
|
+
},
|
78
|
+
"id": "root",
|
79
|
+
"identity": {
|
80
|
+
"gid": 0,
|
81
|
+
"group": "root",
|
82
|
+
"privileged": true,
|
83
|
+
"uid": 0,
|
84
|
+
"user": "root"
|
85
|
+
},
|
86
|
+
"interfaces": "enp0s3,lo",
|
87
|
+
"ipaddress": "10.0.2.15",
|
88
|
+
"ipaddress6": "fe80::bb:7dff:fee8:e923",
|
89
|
+
"ipaddress6_enp0s3": "fe80::bb:7dff:fee8:e923",
|
90
|
+
"ipaddress6_lo": "::1",
|
91
|
+
"ipaddress_enp0s3": "10.0.2.15",
|
92
|
+
"ipaddress_lo": "127.0.0.1",
|
93
|
+
"is_virtual": true,
|
94
|
+
"kernel": "Linux",
|
95
|
+
"kernelmajversion": "4.15",
|
96
|
+
"kernelrelease": "4.15.0-54-generic",
|
97
|
+
"kernelversion": "4.15.0",
|
98
|
+
"load_averages": {
|
99
|
+
"15m": 0.1,
|
100
|
+
"1m": 0.31,
|
101
|
+
"5m": 0.23
|
102
|
+
},
|
103
|
+
"lsbdistcodename": "bionic",
|
104
|
+
"lsbdistdescription": "Ubuntu 18.04.2 LTS",
|
105
|
+
"lsbdistid": "Ubuntu",
|
106
|
+
"lsbdistrelease": "18.04",
|
107
|
+
"lsbmajdistrelease": "18.04",
|
108
|
+
"macaddress": "02:bb:7d:e8:e9:23",
|
109
|
+
"macaddress_enp0s3": "02:bb:7d:e8:e9:23",
|
110
|
+
"manufacturer": "innotek GmbH",
|
111
|
+
"memory": {
|
112
|
+
"system": {
|
113
|
+
"available": "776.53 MiB",
|
114
|
+
"available_bytes": 814247936,
|
115
|
+
"capacity": "21.19%",
|
116
|
+
"total": "985.26 MiB",
|
117
|
+
"total_bytes": 1033121792,
|
118
|
+
"used": "208.73 MiB",
|
119
|
+
"used_bytes": 218873856
|
120
|
+
}
|
121
|
+
},
|
122
|
+
"memoryfree": "776.53 MiB",
|
123
|
+
"memoryfree_mb": 776.52734375,
|
124
|
+
"memorysize": "985.26 MiB",
|
125
|
+
"memorysize_mb": 985.26171875,
|
126
|
+
"mountpoints": {
|
127
|
+
"/": {
|
128
|
+
"available": "8.14 GiB",
|
129
|
+
"available_bytes": 8742756352,
|
130
|
+
"capacity": "15.32%",
|
131
|
+
"device": "/dev/sda1",
|
132
|
+
"filesystem": "ext4",
|
133
|
+
"options": [
|
134
|
+
"rw",
|
135
|
+
"relatime",
|
136
|
+
"data=ordered"
|
137
|
+
],
|
138
|
+
"size": "9.63 GiB",
|
139
|
+
"size_bytes": 10340794368,
|
140
|
+
"used": "1.47 GiB",
|
141
|
+
"used_bytes": 1581260800
|
142
|
+
},
|
143
|
+
"/dev": {
|
144
|
+
"available": "480.22 MiB",
|
145
|
+
"available_bytes": 503545856,
|
146
|
+
"capacity": "0%",
|
147
|
+
"device": "udev",
|
148
|
+
"filesystem": "devtmpfs",
|
149
|
+
"options": [
|
150
|
+
"rw",
|
151
|
+
"nosuid",
|
152
|
+
"relatime",
|
153
|
+
"size=491744k",
|
154
|
+
"nr_inodes=122936",
|
155
|
+
"mode=755"
|
156
|
+
],
|
157
|
+
"size": "480.22 MiB",
|
158
|
+
"size_bytes": 503545856,
|
159
|
+
"used": "0 bytes",
|
160
|
+
"used_bytes": 0
|
161
|
+
},
|
162
|
+
"/dev/hugepages": {
|
163
|
+
"available": "0 bytes",
|
164
|
+
"available_bytes": 0,
|
165
|
+
"capacity": "100%",
|
166
|
+
"device": "hugetlbfs",
|
167
|
+
"filesystem": "hugetlbfs",
|
168
|
+
"options": [
|
169
|
+
"rw",
|
170
|
+
"relatime",
|
171
|
+
"pagesize=2M"
|
172
|
+
],
|
173
|
+
"size": "0 bytes",
|
174
|
+
"size_bytes": 0,
|
175
|
+
"used": "0 bytes",
|
176
|
+
"used_bytes": 0
|
177
|
+
},
|
178
|
+
"/dev/mqueue": {
|
179
|
+
"available": "0 bytes",
|
180
|
+
"available_bytes": 0,
|
181
|
+
"capacity": "100%",
|
182
|
+
"device": "mqueue",
|
183
|
+
"filesystem": "mqueue",
|
184
|
+
"options": [
|
185
|
+
"rw",
|
186
|
+
"relatime"
|
187
|
+
],
|
188
|
+
"size": "0 bytes",
|
189
|
+
"size_bytes": 0,
|
190
|
+
"used": "0 bytes",
|
191
|
+
"used_bytes": 0
|
192
|
+
},
|
193
|
+
"/dev/pts": {
|
194
|
+
"available": "0 bytes",
|
195
|
+
"available_bytes": 0,
|
196
|
+
"capacity": "100%",
|
197
|
+
"device": "devpts",
|
198
|
+
"filesystem": "devpts",
|
199
|
+
"options": [
|
200
|
+
"rw",
|
201
|
+
"nosuid",
|
202
|
+
"noexec",
|
203
|
+
"relatime",
|
204
|
+
"gid=5",
|
205
|
+
"mode=620",
|
206
|
+
"ptmxmode=000"
|
207
|
+
],
|
208
|
+
"size": "0 bytes",
|
209
|
+
"size_bytes": 0,
|
210
|
+
"used": "0 bytes",
|
211
|
+
"used_bytes": 0
|
212
|
+
},
|
213
|
+
"/dev/shm": {
|
214
|
+
"available": "492.63 MiB",
|
215
|
+
"available_bytes": 516558848,
|
216
|
+
"capacity": "0%",
|
217
|
+
"device": "tmpfs",
|
218
|
+
"filesystem": "tmpfs",
|
219
|
+
"options": [
|
220
|
+
"rw",
|
221
|
+
"nosuid",
|
222
|
+
"nodev"
|
223
|
+
],
|
224
|
+
"size": "492.63 MiB",
|
225
|
+
"size_bytes": 516558848,
|
226
|
+
"used": "0 bytes",
|
227
|
+
"used_bytes": 0
|
228
|
+
},
|
229
|
+
"/run": {
|
230
|
+
"available": "97.93 MiB",
|
231
|
+
"available_bytes": 102690816,
|
232
|
+
"capacity": "0.60%",
|
233
|
+
"device": "tmpfs",
|
234
|
+
"filesystem": "tmpfs",
|
235
|
+
"options": [
|
236
|
+
"rw",
|
237
|
+
"nosuid",
|
238
|
+
"noexec",
|
239
|
+
"relatime",
|
240
|
+
"size=100892k",
|
241
|
+
"mode=755"
|
242
|
+
],
|
243
|
+
"size": "98.53 MiB",
|
244
|
+
"size_bytes": 103313408,
|
245
|
+
"used": "608.00 KiB",
|
246
|
+
"used_bytes": 622592
|
247
|
+
},
|
248
|
+
"/run/lock": {
|
249
|
+
"available": "5.00 MiB",
|
250
|
+
"available_bytes": 5242880,
|
251
|
+
"capacity": "0%",
|
252
|
+
"device": "tmpfs",
|
253
|
+
"filesystem": "tmpfs",
|
254
|
+
"options": [
|
255
|
+
"rw",
|
256
|
+
"nosuid",
|
257
|
+
"nodev",
|
258
|
+
"noexec",
|
259
|
+
"relatime",
|
260
|
+
"size=5120k"
|
261
|
+
],
|
262
|
+
"size": "5.00 MiB",
|
263
|
+
"size_bytes": 5242880,
|
264
|
+
"used": "0 bytes",
|
265
|
+
"used_bytes": 0
|
266
|
+
},
|
267
|
+
"/run/user/1000": {
|
268
|
+
"available": "98.52 MiB",
|
269
|
+
"available_bytes": 103309312,
|
270
|
+
"capacity": "0%",
|
271
|
+
"device": "tmpfs",
|
272
|
+
"filesystem": "tmpfs",
|
273
|
+
"options": [
|
274
|
+
"rw",
|
275
|
+
"nosuid",
|
276
|
+
"nodev",
|
277
|
+
"relatime",
|
278
|
+
"size=100888k",
|
279
|
+
"mode=700",
|
280
|
+
"uid=1000",
|
281
|
+
"gid=1000"
|
282
|
+
],
|
283
|
+
"size": "98.52 MiB",
|
284
|
+
"size_bytes": 103309312,
|
285
|
+
"used": "0 bytes",
|
286
|
+
"used_bytes": 0
|
287
|
+
},
|
288
|
+
"/sys/fs/cgroup": {
|
289
|
+
"available": "492.63 MiB",
|
290
|
+
"available_bytes": 516558848,
|
291
|
+
"capacity": "0%",
|
292
|
+
"device": "tmpfs",
|
293
|
+
"filesystem": "tmpfs",
|
294
|
+
"options": [
|
295
|
+
"ro",
|
296
|
+
"nosuid",
|
297
|
+
"nodev",
|
298
|
+
"noexec",
|
299
|
+
"mode=755"
|
300
|
+
],
|
301
|
+
"size": "492.63 MiB",
|
302
|
+
"size_bytes": 516558848,
|
303
|
+
"used": "0 bytes",
|
304
|
+
"used_bytes": 0
|
305
|
+
},
|
306
|
+
"/vagrant": {
|
307
|
+
"available": "122.93 GiB",
|
308
|
+
"available_bytes": 131996221440,
|
309
|
+
"capacity": "85.01%",
|
310
|
+
"device": "vagrant",
|
311
|
+
"filesystem": "vboxsf",
|
312
|
+
"options": [
|
313
|
+
"rw",
|
314
|
+
"nodev",
|
315
|
+
"relatime",
|
316
|
+
"iocharset=utf8",
|
317
|
+
"uid=1000",
|
318
|
+
"gid=1000"
|
319
|
+
],
|
320
|
+
"size": "820.33 GiB",
|
321
|
+
"size_bytes": 880824786944,
|
322
|
+
"used": "697.40 GiB",
|
323
|
+
"used_bytes": 748828565504
|
324
|
+
},
|
325
|
+
"/var/lib/lxcfs": {
|
326
|
+
"available": "0 bytes",
|
327
|
+
"available_bytes": 0,
|
328
|
+
"capacity": "100%",
|
329
|
+
"device": "lxcfs",
|
330
|
+
"filesystem": "fuse.lxcfs",
|
331
|
+
"options": [
|
332
|
+
"rw",
|
333
|
+
"nosuid",
|
334
|
+
"nodev",
|
335
|
+
"relatime",
|
336
|
+
"user_id=0",
|
337
|
+
"group_id=0",
|
338
|
+
"allow_other"
|
339
|
+
],
|
340
|
+
"size": "0 bytes",
|
341
|
+
"size_bytes": 0,
|
342
|
+
"used": "0 bytes",
|
343
|
+
"used_bytes": 0
|
344
|
+
}
|
345
|
+
},
|
346
|
+
"mtu_enp0s3": 1500,
|
347
|
+
"mtu_lo": 65536,
|
348
|
+
"netmask": "255.255.255.0",
|
349
|
+
"netmask6": "ffff:ffff:ffff:ffff::",
|
350
|
+
"netmask6_enp0s3": "ffff:ffff:ffff:ffff::",
|
351
|
+
"netmask6_lo": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
|
352
|
+
"netmask_enp0s3": "255.255.255.0",
|
353
|
+
"netmask_lo": "255.0.0.0",
|
354
|
+
"network": "10.0.2.0",
|
355
|
+
"network6": "fe80::",
|
356
|
+
"network6_enp0s3": "fe80::",
|
357
|
+
"network6_lo": "::1",
|
358
|
+
"network_enp0s3": "10.0.2.0",
|
359
|
+
"network_lo": "127.0.0.0",
|
360
|
+
"networking": {
|
361
|
+
"dhcp": "10.0.2.2",
|
362
|
+
"domain": "lan.asio",
|
363
|
+
"fqdn": "ubuntu-bionic.lan.asio",
|
364
|
+
"hostname": "ubuntu-bionic",
|
365
|
+
"interfaces": {
|
366
|
+
"enp0s3": {
|
367
|
+
"bindings": [
|
368
|
+
{
|
369
|
+
"address": "10.0.2.15",
|
370
|
+
"netmask": "255.255.255.0",
|
371
|
+
"network": "10.0.2.0"
|
372
|
+
}
|
373
|
+
],
|
374
|
+
"bindings6": [
|
375
|
+
{
|
376
|
+
"address": "fe80::bb:7dff:fee8:e923",
|
377
|
+
"netmask": "ffff:ffff:ffff:ffff::",
|
378
|
+
"network": "fe80::"
|
379
|
+
}
|
380
|
+
],
|
381
|
+
"dhcp": "10.0.2.2",
|
382
|
+
"ip": "10.0.2.15",
|
383
|
+
"ip6": "fe80::bb:7dff:fee8:e923",
|
384
|
+
"mac": "02:bb:7d:e8:e9:23",
|
385
|
+
"mtu": 1500,
|
386
|
+
"netmask": "255.255.255.0",
|
387
|
+
"netmask6": "ffff:ffff:ffff:ffff::",
|
388
|
+
"network": "10.0.2.0",
|
389
|
+
"network6": "fe80::",
|
390
|
+
"scope6": "link"
|
391
|
+
},
|
392
|
+
"lo": {
|
393
|
+
"bindings": [
|
394
|
+
{
|
395
|
+
"address": "127.0.0.1",
|
396
|
+
"netmask": "255.0.0.0",
|
397
|
+
"network": "127.0.0.0"
|
398
|
+
}
|
399
|
+
],
|
400
|
+
"bindings6": [
|
401
|
+
{
|
402
|
+
"address": "::1",
|
403
|
+
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
|
404
|
+
"network": "::1"
|
405
|
+
}
|
406
|
+
],
|
407
|
+
"ip": "127.0.0.1",
|
408
|
+
"ip6": "::1",
|
409
|
+
"mtu": 65536,
|
410
|
+
"netmask": "255.0.0.0",
|
411
|
+
"netmask6": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
|
412
|
+
"network": "127.0.0.0",
|
413
|
+
"network6": "::1",
|
414
|
+
"scope6": "host"
|
415
|
+
}
|
416
|
+
},
|
417
|
+
"ip": "10.0.2.15",
|
418
|
+
"ip6": "fe80::bb:7dff:fee8:e923",
|
419
|
+
"mac": "02:bb:7d:e8:e9:23",
|
420
|
+
"mtu": 1500,
|
421
|
+
"netmask": "255.255.255.0",
|
422
|
+
"netmask6": "ffff:ffff:ffff:ffff::",
|
423
|
+
"network": "10.0.2.0",
|
424
|
+
"network6": "fe80::",
|
425
|
+
"primary": "enp0s3",
|
426
|
+
"scope6": "link"
|
427
|
+
},
|
428
|
+
"operatingsystem": "Ubuntu",
|
429
|
+
"operatingsystemmajrelease": "18.04",
|
430
|
+
"operatingsystemrelease": "18.04",
|
431
|
+
"os": {
|
432
|
+
"architecture": "amd64",
|
433
|
+
"distro": {
|
434
|
+
"codename": "bionic",
|
435
|
+
"description": "Ubuntu 18.04.2 LTS",
|
436
|
+
"id": "Ubuntu",
|
437
|
+
"release": {
|
438
|
+
"full": "18.04",
|
439
|
+
"major": "18.04"
|
440
|
+
}
|
441
|
+
},
|
442
|
+
"family": "Debian",
|
443
|
+
"hardware": "x86_64",
|
444
|
+
"name": "Ubuntu",
|
445
|
+
"release": {
|
446
|
+
"full": "18.04",
|
447
|
+
"major": "18.04"
|
448
|
+
},
|
449
|
+
"selinux": {
|
450
|
+
"enabled": false
|
451
|
+
}
|
452
|
+
},
|
453
|
+
"osfamily": "Debian",
|
454
|
+
"partitions": {
|
455
|
+
"/dev/sda1": {
|
456
|
+
"filesystem": "ext4",
|
457
|
+
"label": "cloudimg-rootfs",
|
458
|
+
"mount": "/",
|
459
|
+
"partuuid": "654c6dc7-01",
|
460
|
+
"size": "10.00 GiB",
|
461
|
+
"size_bytes": 10736352768,
|
462
|
+
"uuid": "8de716dd-d9b2-477f-b818-bb0b1eb036ce"
|
463
|
+
}
|
464
|
+
},
|
465
|
+
"path": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/opt/puppetlabs/bin",
|
466
|
+
"physicalprocessorcount": 1,
|
467
|
+
"processor0": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
468
|
+
"processor1": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
469
|
+
"processorcount": 2,
|
470
|
+
"processors": {
|
471
|
+
"count": 2,
|
472
|
+
"isa": "x86_64",
|
473
|
+
"models": [
|
474
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
475
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz"
|
476
|
+
],
|
477
|
+
"physicalcount": 1
|
478
|
+
},
|
479
|
+
"productname": "VirtualBox",
|
480
|
+
"puppetversion": "6.14.0",
|
481
|
+
"ruby": {
|
482
|
+
"platform": "x86_64-linux",
|
483
|
+
"sitedir": "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.5.0",
|
484
|
+
"version": "2.5.7"
|
485
|
+
},
|
486
|
+
"rubyplatform": "x86_64-linux",
|
487
|
+
"rubysitedir": "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.5.0",
|
488
|
+
"rubyversion": "2.5.7",
|
489
|
+
"scope6": "link",
|
490
|
+
"scope6_enp0s3": "link",
|
491
|
+
"scope6_lo": "host",
|
492
|
+
"selinux": false,
|
493
|
+
"serialnumber": "0",
|
494
|
+
"ssh": {
|
495
|
+
"dsa": {
|
496
|
+
"fingerprints": {
|
497
|
+
"sha1": "SSHFP 2 1 7024118ae71eead4750a74d458472e89e38c7e7c",
|
498
|
+
"sha256": "SSHFP 2 2 e5606c7ee1cf32f5591b42c98a9bc87d27cef4bc75c7802cd3f22bcb39333656"
|
499
|
+
},
|
500
|
+
"key": "AAAAB3NzaC1kc3MAAACBAPemHtx92WDon/zDA0oaO5wWOXCUx45+6X9QxJugdryqG3RV0J/ZkKhayANq7NO1GeC3/3EC8celhsHyZFILEEJpFPzW32053dVnOZ6JyQCGb4JKFaCH7DjVnZLlTPyqvraykF3beEhp7dArSpsgsIURJLDRvE3PJdd9DDNtOapXAAAAFQC27/RqfyRjrjSOjNrfsqLm6GoT0QAAAIAJm6rGXMlZ+xNfPfVHsugGNP7BdcFLSWnUGaBQ+51FGkRdVesun6HF5A9/TNBfQ6U2k1BE8Qtc3H8uHrwenIQKyWuhVejvpYVD3NA6hztMWYiidiQ7Ji0O3qkPv4CY5QhlmyPit1gR4aly/fG1H8p+J/XbwrJXMtfR6ND3OXbeYwAAAIEAzDOkrJJgq5f+oPSVaOOmvbNdJ0B003fTyJEH+2yCm3q41O7vakoWv9Qt9mH7T/ivqwMK3yzk1eIpozx8TPU1aOQC3OyehoEXXFY6U5Jcgp0K8WUvVgnC47hAKBkf562aGdWftWNu4GkjI6wcNtZqkeVN/wyazilHRF9GyPdsvHg=",
|
501
|
+
"type": "ssh-dss"
|
502
|
+
},
|
503
|
+
"ecdsa": {
|
504
|
+
"fingerprints": {
|
505
|
+
"sha1": "SSHFP 3 1 aa6b8ac4bccb5afded59e2bf680cc151bbb27ef9",
|
506
|
+
"sha256": "SSHFP 3 2 4ee2dc2ded938a37ef44de4fd3f3add478abfe272f0a50dc7dbb1f9a4839ca99"
|
507
|
+
},
|
508
|
+
"key": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF02SaI3oPW6CVWEvzDuf/XqaUF+OAr4RKNW3hAR8RRBSDEjQGdoejQEYP8lEFa1KeVlkJYnvgrPYwxVSUI6hUA=",
|
509
|
+
"type": "ecdsa-sha2-nistp256"
|
510
|
+
},
|
511
|
+
"ed25519": {
|
512
|
+
"fingerprints": {
|
513
|
+
"sha1": "SSHFP 4 1 a20e01cf434a802607e1aff21e621dd3ada6499f",
|
514
|
+
"sha256": "SSHFP 4 2 569917b95c5299fe3cdd1cc4a37166d1e81106a22bb75a15b99bb8694b2ac8c4"
|
515
|
+
},
|
516
|
+
"key": "AAAAC3NzaC1lZDI1NTE5AAAAIHmh1Z/od2mbHDUkAL2bXswdwp43dPXQOKo9DA8AUDO1",
|
517
|
+
"type": "ssh-ed25519"
|
518
|
+
},
|
519
|
+
"rsa": {
|
520
|
+
"fingerprints": {
|
521
|
+
"sha1": "SSHFP 1 1 3bc833bc8e3e259da03d37aa0c0244ae98f30622",
|
522
|
+
"sha256": "SSHFP 1 2 f27f0e09326c1c8abc2b0691bc6444b77781c0a21e9d99933492f269e5163346"
|
523
|
+
},
|
524
|
+
"key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCw+QuEhOY+IrmAaG1/PgO0nyxYY0VYilhjcM5daSKb61z+XBmBuAsgVxWaQ815OxlwYQunPJZlKnaXZ8yTlnjk8eekxvWnoSLtqKZWW1+RfMyy6n6MyXdno1mwez+5HG3tThC63xE4EWbmKH+fsWuNT2ZpQ49fuWnG8sObv/66QLyCjt+KHMpy9ClHjpYli+0hFhdHTwxGo9H/r4I2En9rBcTy3nQZhZGm1FFh6xnHxnSGm02r2fhsk2x0kw9K1pA7IFtr31hBOu5Po5CJBVJQBd1TEozmNELl2ZISmT0HK3sIV4AG/FmFEsd9+63ST5BbeurlcOEzvxudDJmuroZX",
|
525
|
+
"type": "ssh-rsa"
|
526
|
+
}
|
527
|
+
},
|
528
|
+
"sshdsakey": "AAAAB3NzaC1kc3MAAACBAPemHtx92WDon/zDA0oaO5wWOXCUx45+6X9QxJugdryqG3RV0J/ZkKhayANq7NO1GeC3/3EC8celhsHyZFILEEJpFPzW32053dVnOZ6JyQCGb4JKFaCH7DjVnZLlTPyqvraykF3beEhp7dArSpsgsIURJLDRvE3PJdd9DDNtOapXAAAAFQC27/RqfyRjrjSOjNrfsqLm6GoT0QAAAIAJm6rGXMlZ+xNfPfVHsugGNP7BdcFLSWnUGaBQ+51FGkRdVesun6HF5A9/TNBfQ6U2k1BE8Qtc3H8uHrwenIQKyWuhVejvpYVD3NA6hztMWYiidiQ7Ji0O3qkPv4CY5QhlmyPit1gR4aly/fG1H8p+J/XbwrJXMtfR6ND3OXbeYwAAAIEAzDOkrJJgq5f+oPSVaOOmvbNdJ0B003fTyJEH+2yCm3q41O7vakoWv9Qt9mH7T/ivqwMK3yzk1eIpozx8TPU1aOQC3OyehoEXXFY6U5Jcgp0K8WUvVgnC47hAKBkf562aGdWftWNu4GkjI6wcNtZqkeVN/wyazilHRF9GyPdsvHg=",
|
529
|
+
"sshecdsakey": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF02SaI3oPW6CVWEvzDuf/XqaUF+OAr4RKNW3hAR8RRBSDEjQGdoejQEYP8lEFa1KeVlkJYnvgrPYwxVSUI6hUA=",
|
530
|
+
"sshed25519key": "AAAAC3NzaC1lZDI1NTE5AAAAIHmh1Z/od2mbHDUkAL2bXswdwp43dPXQOKo9DA8AUDO1",
|
531
|
+
"sshfp_dsa": "SSHFP 2 1 7024118ae71eead4750a74d458472e89e38c7e7c\nSSHFP 2 2 e5606c7ee1cf32f5591b42c98a9bc87d27cef4bc75c7802cd3f22bcb39333656",
|
532
|
+
"sshfp_ecdsa": "SSHFP 3 1 aa6b8ac4bccb5afded59e2bf680cc151bbb27ef9\nSSHFP 3 2 4ee2dc2ded938a37ef44de4fd3f3add478abfe272f0a50dc7dbb1f9a4839ca99",
|
533
|
+
"sshfp_ed25519": "SSHFP 4 1 a20e01cf434a802607e1aff21e621dd3ada6499f\nSSHFP 4 2 569917b95c5299fe3cdd1cc4a37166d1e81106a22bb75a15b99bb8694b2ac8c4",
|
534
|
+
"sshfp_rsa": "SSHFP 1 1 3bc833bc8e3e259da03d37aa0c0244ae98f30622\nSSHFP 1 2 f27f0e09326c1c8abc2b0691bc6444b77781c0a21e9d99933492f269e5163346",
|
535
|
+
"sshrsakey": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCw+QuEhOY+IrmAaG1/PgO0nyxYY0VYilhjcM5daSKb61z+XBmBuAsgVxWaQ815OxlwYQunPJZlKnaXZ8yTlnjk8eekxvWnoSLtqKZWW1+RfMyy6n6MyXdno1mwez+5HG3tThC63xE4EWbmKH+fsWuNT2ZpQ49fuWnG8sObv/66QLyCjt+KHMpy9ClHjpYli+0hFhdHTwxGo9H/r4I2En9rBcTy3nQZhZGm1FFh6xnHxnSGm02r2fhsk2x0kw9K1pA7IFtr31hBOu5Po5CJBVJQBd1TEozmNELl2ZISmT0HK3sIV4AG/FmFEsd9+63ST5BbeurlcOEzvxudDJmuroZX",
|
536
|
+
"system_uptime": {
|
537
|
+
"days": 0,
|
538
|
+
"hours": 0,
|
539
|
+
"seconds": 336,
|
540
|
+
"uptime": "0:05 hours"
|
541
|
+
},
|
542
|
+
"timezone": "UTC",
|
543
|
+
"uptime": "0:05 hours",
|
544
|
+
"uptime_days": 0,
|
545
|
+
"uptime_hours": 0,
|
546
|
+
"uptime_seconds": 336,
|
547
|
+
"uuid": "2C7D24ED-FB7D-4B4C-BC4B-B9FC32C8BDC3",
|
548
|
+
"virtual": "virtualbox",
|
549
|
+
"clientcert": "ubuntu-bionic.lan.asio",
|
550
|
+
"clientversion": "6.14.0",
|
551
|
+
"clientnoop": false
|
552
|
+
},
|
553
|
+
"timestamp": "2020-04-29T09:42:42.131094744+00:00",
|
554
|
+
"expiration": "2020-04-29T10:12:42.131454548+00:00"
|
555
|
+
}
|
556
|
+
|
data/factsets/windows-10-64.json
CHANGED
@@ -83,6 +83,7 @@
|
|
83
83
|
"rubysitedir": "C:/tools/ruby24/lib/ruby/site_ruby/2.4.0",
|
84
84
|
"rubyversion": "2.4.3",
|
85
85
|
"system32": "C:\\Windows\\system32",
|
86
|
+
"choco_install_path": "C:\\ProgramData\\chocolatey",
|
86
87
|
"system_uptime": {
|
87
88
|
"seconds": 1113359,
|
88
89
|
"hours": 309,
|
@@ -100,4 +101,4 @@
|
|
100
101
|
},
|
101
102
|
"timestamp": "2018-12-10T21:43:07.468533000+00:00",
|
102
103
|
"expiration": "2018-12-10T22:13:07.468533000+00:00"
|
103
|
-
}
|
104
|
+
}
|
@@ -37,6 +37,17 @@ When(/^I run onceover command "([^"]*)" with class "([^"]*)"$/) do |command, cl
|
|
37
37
|
@cmd.run
|
38
38
|
end
|
39
39
|
|
40
|
+
# The below can be used to skip tests if they only work on one os
|
41
|
+
When(/^test osfamily is "(\w*)"$/) do |osfamily|
|
42
|
+
require 'facter'
|
43
|
+
pending unless Facter.value(:os)['family'] == osfamily
|
44
|
+
end
|
45
|
+
|
46
|
+
When(/^test osfamily is not "(\w*)"$/) do |osfamily|
|
47
|
+
require 'facter'
|
48
|
+
pending if Facter.value(:os)['family'] == osfamily
|
49
|
+
end
|
50
|
+
|
40
51
|
Then(/^I see help for commands: "([^"]*)"$/) do |commands|
|
41
52
|
# Get chunk of output between COMMANDS and OPTION, there should be help section
|
42
53
|
commands_help = @cmd.output[/COMMANDS(.*)OPTIONS/m, 1]
|
@@ -0,0 +1,30 @@
|
|
1
|
+
@windows
|
2
|
+
Feature: Run onceover with windows
|
3
|
+
Onceover should allow to run rspec and acceptance test for all profvile and role classes
|
4
|
+
or for any part of them. Use should set if he wants to see only summary of tests or full
|
5
|
+
log info.
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given onceover executable
|
9
|
+
|
10
|
+
Scenario: Run with common Windows code
|
11
|
+
Given control repo "windows"
|
12
|
+
When I run onceover command "run spec" with class "role::users"
|
13
|
+
Then I should not see any errors
|
14
|
+
|
15
|
+
Scenario: Run with common Windows code without workarounds
|
16
|
+
Given existing control repo "windows"
|
17
|
+
When I run onceover command "run spec --no_workarounds" with class "role::users"
|
18
|
+
And test osfamily is not "windows"
|
19
|
+
Then Onceover should exit 1
|
20
|
+
|
21
|
+
Scenario: Compiling a windows role with groups that is valid should compile
|
22
|
+
Given control repo "windows"
|
23
|
+
When I run onceover command "run spec" with class "role::groups"
|
24
|
+
Then I should not see any errors
|
25
|
+
|
26
|
+
Scenario: Compiling a windows role with users that is valid should compile
|
27
|
+
Given control repo "windows"
|
28
|
+
When I run onceover command "run spec" with class "role::users"
|
29
|
+
Then I should not see any errors
|
30
|
+
|
File without changes
|
data/lib/onceover/cli/run.rb
CHANGED
@@ -42,6 +42,7 @@ This includes deploying using r10k and running all custom tests.
|
|
42
42
|
|
43
43
|
optional :p, :parallel, 'Runs spec tests in parallel. This increases speed at the cost of poorly formatted logs and irrelevant junit output.'
|
44
44
|
optional nil, :format, 'Which RSpec formatter to use, valid options are: documentation, progress, FailureCollector, OnceoverFormatter. You also specify this multiple times', multiple: true, default: :defaults
|
45
|
+
optional nil, :no_workarounds, 'Disables workarounds that have been added for convenience to get around common RSPec issues such as https://github.com/rodjek/rspec-puppet/issues/665'
|
45
46
|
|
46
47
|
run do |opts, args, cmd|
|
47
48
|
repo = Onceover::Controlrepo.new(opts)
|
data/lib/onceover/controlrepo.rb
CHANGED
@@ -206,7 +206,7 @@ class Onceover
|
|
206
206
|
end
|
207
207
|
|
208
208
|
def print_puppetfile_table
|
209
|
-
require '
|
209
|
+
require 'terminal-table'
|
210
210
|
require 'versionomy'
|
211
211
|
require 'colored'
|
212
212
|
require 'r10k/puppetfile'
|
@@ -221,48 +221,44 @@ class Onceover
|
|
221
221
|
threads = []
|
222
222
|
puppetfile.modules.each do |mod|
|
223
223
|
threads << Thread.new do
|
224
|
-
|
224
|
+
row = []
|
225
225
|
logger.debug "Loading data for #{mod.full_name}"
|
226
|
-
|
226
|
+
row << mod.full_name
|
227
227
|
if mod.is_a?(R10K::Module::Forge)
|
228
|
-
|
229
|
-
|
230
|
-
|
228
|
+
row << mod.expected_version
|
229
|
+
row << mod.v3_module.current_release.version
|
230
|
+
|
231
|
+
current = Versionomy.parse(mod.expected_version)
|
232
|
+
latest = Versionomy.parse(mod.v3_module.current_release.version)
|
233
|
+
row << if current.major < latest.major
|
234
|
+
"Major".red
|
235
|
+
elsif current.minor < latest.minor
|
236
|
+
"Minor".yellow
|
237
|
+
elsif current.tiny < latest.tiny
|
238
|
+
"Tiny".green
|
239
|
+
else
|
240
|
+
"No".green
|
241
|
+
end
|
242
|
+
|
243
|
+
row << mod.v3_module.endorsement
|
231
244
|
superseded_by = mod.v3_module.superseded_by
|
232
|
-
|
233
|
-
current = Versionomy.parse(return_hash[:current_version])
|
234
|
-
latest = Versionomy.parse(return_hash[:latest_version])
|
235
|
-
if current.major < latest.major
|
236
|
-
return_hash[:out_of_date] = "Major".red
|
237
|
-
elsif current.minor < latest.minor
|
238
|
-
return_hash[:out_of_date] = "Minor".yellow
|
239
|
-
elsif current.tiny < latest.tiny
|
240
|
-
return_hash[:out_of_date] = "Tiny".green
|
241
|
-
else
|
242
|
-
return_hash[:out_of_date] = "No".green
|
243
|
-
end
|
245
|
+
row << (superseded_by.nil? ? '' : superseded_by[:slug])
|
244
246
|
else
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
247
|
+
row << "N/A"
|
248
|
+
row << "N/A"
|
249
|
+
row << "N/A"
|
250
|
+
row << "N/A"
|
251
|
+
row << "N/A"
|
250
252
|
end
|
251
|
-
output_array <<
|
253
|
+
output_array << row
|
252
254
|
end
|
253
255
|
end
|
254
256
|
|
255
257
|
threads.map(&:join)
|
256
258
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
{:current_version => {:display_name => "Current Version"}},
|
261
|
-
{:latest_version => {:display_name => "Latest Version"}},
|
262
|
-
{:out_of_date => {:display_name => "Out of Date?"}},
|
263
|
-
{:endorsement => {:display_name => "Endorsement"}},
|
264
|
-
{:superseded_by => {:display_name => "Superseded by"}}
|
265
|
-
)
|
259
|
+
output_array.sort_by! { |line| line[0] }
|
260
|
+
|
261
|
+
puts Terminal::Table.new(headings: ["Full Name", "Current Version", "Latest Version", "Out of Date?", "Endorsement", "Superseded by"], rows: output_array)
|
266
262
|
end
|
267
263
|
|
268
264
|
def update_puppetfile
|
data/lib/onceover/runner.rb
CHANGED
@@ -24,8 +24,8 @@ class Onceover
|
|
24
24
|
FileUtils.mkdir_p("#{@repo.tempdir}/spec/classes")
|
25
25
|
FileUtils.mkdir_p("#{@repo.tempdir}/spec/acceptance/nodesets")
|
26
26
|
|
27
|
-
# Copy
|
28
|
-
|
27
|
+
# Copy specified spec files over
|
28
|
+
@config.copy_spec_files(@repo)
|
29
29
|
|
30
30
|
# Create the Rakefile so that we can take advantage of the existing tasks
|
31
31
|
@config.write_rakefile(@repo.tempdir, "spec/classes/**/*_spec.rb")
|
@@ -87,10 +87,11 @@ class Onceover
|
|
87
87
|
#`bin/rake spec_standalone`
|
88
88
|
if @config.opts[:parallel]
|
89
89
|
logger.debug "Running #{@command_prefix}rake parallel_spec from #{@repo.tempdir}"
|
90
|
-
result =
|
90
|
+
result = run_command(@command_prefix.strip.split, 'rake', 'parallel_spec')
|
91
91
|
else
|
92
|
+
require 'io/console'
|
92
93
|
logger.debug "Running #{@command_prefix}rake spec_standalone from #{@repo.tempdir}"
|
93
|
-
result =
|
94
|
+
result = run_command(@command_prefix.strip.split, 'rake', 'spec_standalone')
|
94
95
|
end
|
95
96
|
|
96
97
|
# Reset env to previous state if we modified it
|
@@ -117,11 +118,20 @@ class Onceover
|
|
117
118
|
#`bundle install --binstubs`
|
118
119
|
#`bin/rake spec_standalone`
|
119
120
|
logger.debug "Running #{@command_prefix}rake acceptance from #{@repo.tempdir}"
|
120
|
-
result =
|
121
|
+
result = run_command(@command_prefix.strip.split, 'rake', 'acceptance')
|
121
122
|
end
|
122
123
|
|
123
124
|
# Finally exit and preserve the exit code
|
124
125
|
exit result.status.exitstatus
|
125
126
|
end
|
127
|
+
|
128
|
+
def run_command(*args)
|
129
|
+
begin
|
130
|
+
STDERR.raw! if STDERR.isatty
|
131
|
+
result = Backticks::Runner.new(interactive: true).run(args.flatten).join
|
132
|
+
ensure
|
133
|
+
STDERR.cooked! if STDERR.isatty
|
134
|
+
end
|
135
|
+
end
|
126
136
|
end
|
127
137
|
end
|
data/lib/onceover/testconfig.rb
CHANGED
@@ -47,9 +47,10 @@ class Onceover
|
|
47
47
|
@acceptance_tests = []
|
48
48
|
@opts = opts
|
49
49
|
@mock_functions = config['functions']
|
50
|
-
@before_conditions = config['before']
|
50
|
+
@before_conditions = config['before'] || []
|
51
51
|
@after_conditions = config['after']
|
52
52
|
@strict_variables = opts[:strict_variables] ? 'yes' : 'no'
|
53
|
+
@included_specs = [config['include_spec_files'] || ['**/*']].flatten
|
53
54
|
|
54
55
|
# Set dynamic defaults for format
|
55
56
|
if Array(opts[:format]) == [:defaults]
|
@@ -236,6 +237,19 @@ class Onceover
|
|
236
237
|
)
|
237
238
|
end
|
238
239
|
|
240
|
+
def copy_spec_files(repo)
|
241
|
+
source_files = @included_specs.map { |glob| Dir.glob "#{repo.spec_dir}/#{glob}" }.flatten.uniq
|
242
|
+
source_files.each do |source_file|
|
243
|
+
target_file = File.join(repo.tempdir, 'spec', source_file.sub(/^#{repo.spec_dir}/, ''))
|
244
|
+
if File.directory?(source_file)
|
245
|
+
FileUtils.cp_r source_file, target_file unless File.exists? target_file
|
246
|
+
else
|
247
|
+
FileUtils.mkdir_p File.dirname target_file
|
248
|
+
FileUtils.cp source_file, target_file
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
239
253
|
def create_fixtures_symlinks(repo)
|
240
254
|
logger.debug "Creating fixtures symlinks"
|
241
255
|
FileUtils.rm_rf("#{repo.tempdir}/spec/fixtures/modules")
|
data/onceover.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "onceover"
|
7
|
-
s.version = "3.
|
7
|
+
s.version = "3.18.0"
|
8
8
|
s.authors = ["Dylan Ratcliffe"]
|
9
9
|
s.email = ["dylan.ratcliffe@puppet.com"]
|
10
10
|
s.homepage = "https://github.com/dylanratcliffe/onceover"
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.add_runtime_dependency 'rspec', '>= 3.0.0'
|
35
35
|
s.add_runtime_dependency 'rspec-puppet', ">= 2.4.0"
|
36
36
|
s.add_runtime_dependency 'rspec_junit_formatter', '>= 0.2.0'
|
37
|
-
s.add_runtime_dependency '
|
37
|
+
s.add_runtime_dependency 'terminal-table', '>= 1.8.0'
|
38
38
|
s.add_runtime_dependency 'versionomy', '>= 0.5.0'
|
39
39
|
|
40
40
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
modulepath = site-modules:modules:$basemodulepath
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class role::acl {
|
2
|
+
# ACL often causes failures such as this:
|
3
|
+
# https://github.com/rodjek/rspec-puppet/issues/665
|
4
|
+
#
|
5
|
+
# Onceover should handle this out of the box
|
6
|
+
acl { 'L:\\SQLBackup':
|
7
|
+
inherit_parent_permissions => false,
|
8
|
+
permissions => [
|
9
|
+
{ 'identity' => 'foo', 'rights' => ['read'] }
|
10
|
+
],
|
11
|
+
}
|
12
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Classes to be tested
|
2
|
+
classes:
|
3
|
+
- /role::/
|
4
|
+
|
5
|
+
# Nodes to tests classes on, this refers to a 'factset' or 'nodeset'
|
6
|
+
# depending on whether you are running 'spec' or 'acceptance' tests
|
7
|
+
nodes:
|
8
|
+
- Windows_Server-2012r2-64
|
9
|
+
- windows-10-64
|
10
|
+
- Windows_Server-2008r2-64
|
11
|
+
|
12
|
+
# You can group classes here to save typing
|
13
|
+
class_groups:
|
14
|
+
|
15
|
+
# You can group nodes here to save typing
|
16
|
+
# We have created a 'non_windows_nodes' group because we can't
|
17
|
+
# give you Windows vagrant boxes to test with because licensing,
|
18
|
+
# we can give you fact sets though so go crazy with spec testing!
|
19
|
+
node_groups:
|
20
|
+
|
21
|
+
test_matrix:
|
22
|
+
- all_nodes:
|
23
|
+
classes: "all_classes"
|
24
|
+
tests: "spec"
|
data/templates/test_spec.rb.erb
CHANGED
@@ -29,6 +29,7 @@ describe "<%= cls.name %>" do
|
|
29
29
|
end
|
30
30
|
<% end -%>
|
31
31
|
|
32
|
+
<% unless opts[:no_workarounds] -%>
|
32
33
|
before :each do
|
33
34
|
# Curtrently there is some code within Puppet that will try to execute
|
34
35
|
# commands when compiling a catalog even though it shouldn't. One example is
|
@@ -41,7 +42,66 @@ describe "<%= cls.name %>" do
|
|
41
42
|
unless File.exist? expected_null_file
|
42
43
|
allow(Puppet::Util::Execution).to receive(:execute).and_raise(Puppet::ExecutionFailure.new("Onceover caused this"))
|
43
44
|
end
|
45
|
+
|
46
|
+
# The windows ACL module causes issues when compiled on other platforms
|
47
|
+
# These are detailed in the following ticket:
|
48
|
+
# https://github.com/rodjek/rspec-puppet/issues/665
|
49
|
+
#
|
50
|
+
# The below should work around this common issue
|
51
|
+
if Puppet::Type.type(:acl)
|
52
|
+
allow_any_instance_of(Puppet::Type.type(:acl).provider(:windows)).to receive(:validate)
|
53
|
+
allow_any_instance_of(Puppet::Type.type(:acl).provider(:windows)).to receive(:respond_to?).with(:get_account_name).and_return(false)
|
54
|
+
allow_any_instance_of(Puppet::Type.type(:acl).provider(:windows)).to receive(:respond_to?).with(:get_group_name).and_return(false)
|
55
|
+
allow_any_instance_of(Puppet::Type.type(:acl).provider(:windows)).to receive(:respond_to?).with(:validate).and_return(true)
|
56
|
+
end
|
57
|
+
|
58
|
+
# The windows_adsi provider also has an issue where the contructor takes
|
59
|
+
# a different number of arguments depending on whether the ADSI
|
60
|
+
# underlying connectivity exists. This causes the following error:
|
61
|
+
#
|
62
|
+
# wrong number of arguments (given 1, expected 0)
|
63
|
+
#
|
64
|
+
# This fixes that if we aren't using Windows
|
65
|
+
begin
|
66
|
+
# Test to see if this works without modification
|
67
|
+
require 'puppet/util/windows'
|
68
|
+
require 'puppet/util/windows/adsi'
|
69
|
+
Puppet::Util::Windows::ADSI.computer_name
|
70
|
+
rescue LoadError, StandardError
|
71
|
+
# Declare an entire mocked module because for some reason we can't load it unless we are on Windows
|
72
|
+
module Puppet::Util::Windows
|
73
|
+
module ADSI
|
74
|
+
class ADSIObject; end
|
75
|
+
class User < ADSIObject; end
|
76
|
+
class UserProfile; end
|
77
|
+
class Group < ADSIObject; end
|
78
|
+
end
|
79
|
+
module File; end
|
80
|
+
module Registry
|
81
|
+
end
|
82
|
+
module SID
|
83
|
+
class Principal; end
|
84
|
+
end
|
85
|
+
class EventLog; end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Mock commonly used things
|
89
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_sid).and_return('S-1-5-32-544')
|
90
|
+
allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).and_return(nil)
|
91
|
+
|
92
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::User).to receive(:initialize)
|
93
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::User).to receive(:groups).and_return([])
|
94
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::User).to receive(:name_sid_hash).and_return({})
|
95
|
+
|
96
|
+
# Group instance methods
|
97
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::Group).to receive(:members).and_return([])
|
98
|
+
allow_any_instance_of(Puppet::Util::Windows::ADSI::Group).to receive(:members_sids).and_return([])
|
99
|
+
|
100
|
+
# Class methods
|
101
|
+
allow(Puppet::Util::Windows::ADSI::Group).to receive(:name_sid_hash).and_return({})
|
102
|
+
end
|
44
103
|
end
|
104
|
+
<% end -%>
|
45
105
|
|
46
106
|
<% if @after_conditions -%>
|
47
107
|
after :each do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onceover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Ratcliffe
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backticks
|
@@ -235,19 +235,19 @@ dependencies:
|
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 0.2.0
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
|
-
name:
|
238
|
+
name: terminal-table
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
241
|
- - ">="
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: 1.
|
243
|
+
version: 1.8.0
|
244
244
|
type: :runtime
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
248
|
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version: 1.
|
250
|
+
version: 1.8.0
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
252
|
name: versionomy
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -299,6 +299,7 @@ files:
|
|
299
299
|
- factsets/Ubuntu-12.04-64.json
|
300
300
|
- factsets/Ubuntu-14.04-32.json
|
301
301
|
- factsets/Ubuntu-14.04-64.json
|
302
|
+
- factsets/Ubuntu-18.04-64.json
|
302
303
|
- factsets/Windows_Server-2008r2-64.json
|
303
304
|
- factsets/Windows_Server-2012r2-64.json
|
304
305
|
- factsets/solaris-10_u9-sparc-64.json
|
@@ -309,7 +310,6 @@ files:
|
|
309
310
|
- features/formatting.feature
|
310
311
|
- features/help.feature
|
311
312
|
- features/init.feature
|
312
|
-
- features/run.feature
|
313
313
|
- features/show.feature
|
314
314
|
- features/step_definitions/cache.rb
|
315
315
|
- features/step_definitions/common.rb
|
@@ -320,6 +320,8 @@ files:
|
|
320
320
|
- features/support/command_helper.rb
|
321
321
|
- features/support/controlrepo_helper.rb
|
322
322
|
- features/support/env.rb
|
323
|
+
- features/windows.feature
|
324
|
+
- features/zzz_run.feature
|
323
325
|
- lib/onceover/beaker.rb
|
324
326
|
- lib/onceover/beaker/spec_helper.rb
|
325
327
|
- lib/onceover/class.rb
|
@@ -388,6 +390,15 @@ files:
|
|
388
390
|
- spec/fixtures/controlrepos/function_mocking/site/role/manifests/test_new_functions.pp
|
389
391
|
- spec/fixtures/controlrepos/function_mocking/spec/onceover.yaml
|
390
392
|
- spec/fixtures/controlrepos/minimal/environment.conf
|
393
|
+
- spec/fixtures/controlrepos/windows/Gemfile
|
394
|
+
- spec/fixtures/controlrepos/windows/Puppetfile
|
395
|
+
- spec/fixtures/controlrepos/windows/environment.conf
|
396
|
+
- spec/fixtures/controlrepos/windows/site-modules/role/manifests/acl.pp
|
397
|
+
- spec/fixtures/controlrepos/windows/site-modules/role/manifests/groups.pp
|
398
|
+
- spec/fixtures/controlrepos/windows/site-modules/role/manifests/users.pp
|
399
|
+
- spec/fixtures/controlrepos/windows/site/role/manifests/groups.pp
|
400
|
+
- spec/fixtures/controlrepos/windows/site/role/manifests/users.pp
|
401
|
+
- spec/fixtures/controlrepos/windows/spec/onceover.yaml
|
391
402
|
- spec/onceover/controlrepo_spec.rb
|
392
403
|
- spec/spec_helper.rb
|
393
404
|
- templates/.fixtures.yml.erb
|
@@ -407,7 +418,7 @@ homepage: https://github.com/dylanratcliffe/onceover
|
|
407
418
|
licenses:
|
408
419
|
- Apache-2.0
|
409
420
|
metadata: {}
|
410
|
-
post_install_message:
|
421
|
+
post_install_message:
|
411
422
|
rdoc_options: []
|
412
423
|
require_paths:
|
413
424
|
- lib
|
@@ -422,9 +433,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
422
433
|
- !ruby/object:Gem::Version
|
423
434
|
version: '0'
|
424
435
|
requirements: []
|
425
|
-
rubyforge_project:
|
436
|
+
rubyforge_project:
|
426
437
|
rubygems_version: 2.7.6.2
|
427
|
-
signing_key:
|
438
|
+
signing_key:
|
428
439
|
specification_version: 4
|
429
440
|
summary: Testing tools for Puppet controlrepos
|
430
441
|
test_files: []
|