pdqtest 1.4.1 → 1.9.9beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -3
  3. data/doc/acceptance_tests.md +100 -22
  4. data/doc/caching.md +5 -1
  5. data/doc/development.md +16 -5
  6. data/doc/emoji.md +20 -9
  7. data/doc/enabling_testing.md +15 -3
  8. data/doc/examples.md +25 -6
  9. data/doc/hiera.md +30 -11
  10. data/doc/installation.md +59 -8
  11. data/doc/pdk.md +334 -0
  12. data/doc/puppet_facts.md +45 -3
  13. data/doc/puppet_module_dependencies.md +34 -16
  14. data/doc/running_tests.md +35 -15
  15. data/doc/test_generation.md +11 -19
  16. data/doc/tips_and_tricks.md +17 -8
  17. data/doc/troubleshooting.md +19 -8
  18. data/doc/upgrading.md +125 -6
  19. data/doc/windows.md +51 -0
  20. data/docker_images/centos/Dockerfile +4 -3
  21. data/docker_images/centos/Makefile +1 -1
  22. data/docker_images/ubuntu/Dockerfile +3 -3
  23. data/docker_images/windows/Dockerfile +26 -0
  24. data/docker_images/windows/make.ps1 +2 -0
  25. data/exe/pdqtest +73 -28
  26. data/lib/pdqtest/core.rb +1 -1
  27. data/lib/pdqtest/docker.rb +143 -51
  28. data/lib/pdqtest/emoji.rb +33 -7
  29. data/lib/pdqtest/fastcheck.rb +19 -0
  30. data/lib/pdqtest/instance.rb +16 -15
  31. data/lib/pdqtest/logger.rb +35 -0
  32. data/lib/pdqtest/pdk.rb +98 -0
  33. data/lib/pdqtest/pdqtest1x.rb +115 -0
  34. data/lib/pdqtest/puppet.rb +277 -134
  35. data/lib/pdqtest/skeleton.rb +119 -39
  36. data/lib/pdqtest/upgrade.rb +42 -42
  37. data/lib/pdqtest/util.rb +82 -2
  38. data/lib/pdqtest/version.rb +1 -2
  39. data/pdqtest.gemspec +8 -13
  40. data/res/{skeleton → acceptance}/init.bats +0 -0
  41. data/res/{skeleton → acceptance}/init__before.bats +0 -0
  42. data/res/{skeleton → acceptance}/init__setup.sh +0 -0
  43. data/res/skeleton/.puppet-lint.rc +5 -0
  44. data/res/skeleton/{dot_travis.yml → .travis.yml} +0 -0
  45. data/res/skeleton/Makefile +20 -5
  46. data/res/skeleton/make.ps1 +66 -0
  47. data/res/skeleton/spec/fixtures/hiera.yaml +13 -0
  48. data/res/skeleton/spec/fixtures/hieradata/test.yaml +11 -0
  49. data/res/templates/examples_init.pp.erb +1 -1
  50. metadata +47 -115
  51. data/lib/pdqtest/lint.rb +0 -31
  52. data/lib/pdqtest/rspec.rb +0 -69
  53. data/lib/pdqtest/syntax.rb +0 -20
  54. data/res/skeleton/Gemfile +0 -7
  55. data/res/skeleton/Rakefile +0 -3
  56. data/res/skeleton/dot_gitignore +0 -9
  57. data/res/skeleton/dot_rspec +0 -2
  58. data/res/skeleton/hiera.yaml +0 -7
  59. data/res/skeleton/spec_helper.rb +0 -4
  60. data/res/skeleton/test.yaml +0 -3
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdqtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.9.9beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-31 00:00:00.000000000 Z
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.1
19
+ version: '1.16'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.1
26
+ version: '1.16'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coveralls
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,33 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.8.21
41
41
  - !ruby/object:Gem::Dependency
42
- name: fakefs
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 0.14.2
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 0.14.2
55
- - !ruby/object:Gem::Dependency
56
- name: puppet
42
+ name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - '='
60
46
  - !ruby/object:Gem::Version
61
- version: 5.3.5
47
+ version: 3.7.0
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - '='
67
53
  - !ruby/object:Gem::Version
68
- version: 5.3.5
54
+ version: 3.7.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +66,6 @@ dependencies:
80
66
  - - '='
81
67
  - !ruby/object:Gem::Version
82
68
  version: 12.3.1
83
- - !ruby/object:Gem::Dependency
84
- name: rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: 3.7.0
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: 3.7.0
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: thor
99
71
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +94,6 @@ dependencies:
122
94
  - - '='
123
95
  - !ruby/object:Gem::Version
124
96
  version: 0.6.1
125
- - !ruby/object:Gem::Dependency
126
- name: hiera
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - '='
130
- - !ruby/object:Gem::Version
131
- version: 3.4.2
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - '='
137
- - !ruby/object:Gem::Version
138
- version: 3.4.2
139
97
  - !ruby/object:Gem::Dependency
140
98
  name: escort
141
99
  requirement: !ruby/object:Gem::Requirement
@@ -165,92 +123,64 @@ dependencies:
165
123
  - !ruby/object:Gem::Version
166
124
  version: 1.34.2
167
125
  - !ruby/object:Gem::Dependency
168
- name: puppet-lint
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - '='
172
- - !ruby/object:Gem::Version
173
- version: 2.3.5
174
- type: :runtime
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - '='
179
- - !ruby/object:Gem::Version
180
- version: 2.3.5
181
- - !ruby/object:Gem::Dependency
182
- name: puppet-syntax
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - '='
186
- - !ruby/object:Gem::Version
187
- version: 2.4.1
188
- type: :runtime
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - '='
193
- - !ruby/object:Gem::Version
194
- version: 2.4.1
195
- - !ruby/object:Gem::Dependency
196
- name: puppetlabs_spec_helper
126
+ name: r10k
197
127
  requirement: !ruby/object:Gem::Requirement
198
128
  requirements:
199
129
  - - '='
200
130
  - !ruby/object:Gem::Version
201
- version: 2.7.0
131
+ version: 2.6.4
202
132
  type: :runtime
203
133
  prerelease: false
204
134
  version_requirements: !ruby/object:Gem::Requirement
205
135
  requirements:
206
136
  - - '='
207
137
  - !ruby/object:Gem::Version
208
- version: 2.7.0
138
+ version: 2.6.4
209
139
  - !ruby/object:Gem::Dependency
210
- name: r10k
140
+ name: logging
211
141
  requirement: !ruby/object:Gem::Requirement
212
142
  requirements:
213
- - - '='
143
+ - - "~>"
214
144
  - !ruby/object:Gem::Version
215
- version: 2.6.2
145
+ version: '2.2'
216
146
  type: :runtime
217
147
  prerelease: false
218
148
  version_requirements: !ruby/object:Gem::Requirement
219
149
  requirements:
220
- - - '='
150
+ - - "~>"
221
151
  - !ruby/object:Gem::Version
222
- version: 2.6.2
152
+ version: '2.2'
223
153
  - !ruby/object:Gem::Dependency
224
- name: git_refresh
154
+ name: deep_merge
225
155
  requirement: !ruby/object:Gem::Requirement
226
156
  requirements:
227
- - - '='
157
+ - - "~>"
228
158
  - !ruby/object:Gem::Version
229
- version: 0.1.1
159
+ version: '1.2'
230
160
  type: :runtime
231
161
  prerelease: false
232
162
  version_requirements: !ruby/object:Gem::Requirement
233
163
  requirements:
234
- - - '='
164
+ - - "~>"
235
165
  - !ruby/object:Gem::Version
236
- version: 0.1.1
166
+ version: '1.2'
237
167
  - !ruby/object:Gem::Dependency
238
- name: puppet_factset
168
+ name: json
239
169
  requirement: !ruby/object:Gem::Requirement
240
170
  requirements:
241
- - - '='
171
+ - - "<="
242
172
  - !ruby/object:Gem::Version
243
- version: 0.5.0
173
+ version: 2.0.4
244
174
  type: :runtime
245
175
  prerelease: false
246
176
  version_requirements: !ruby/object:Gem::Requirement
247
177
  requirements:
248
- - - '='
178
+ - - "<="
249
179
  - !ruby/object:Gem::Version
250
- version: 0.5.0
180
+ version: 2.0.4
251
181
  description:
252
182
  email:
253
- - geoff.williams@puppetlabs.com
183
+ - geoff@declarativesystems.com
254
184
  executables:
255
185
  - pdqtest
256
186
  extensions: []
@@ -274,6 +204,7 @@ files:
274
204
  - doc/examples.md
275
205
  - doc/hiera.md
276
206
  - doc/installation.md
207
+ - doc/pdk.md
277
208
  - doc/puppet_facts.md
278
209
  - doc/puppet_module_dependencies.md
279
210
  - doc/running_tests.md
@@ -281,41 +212,42 @@ files:
281
212
  - doc/tips_and_tricks.md
282
213
  - doc/troubleshooting.md
283
214
  - doc/upgrading.md
215
+ - doc/windows.md
284
216
  - docker_images/centos/Dockerfile
285
217
  - docker_images/centos/Makefile
286
218
  - docker_images/ubuntu/Dockerfile
287
219
  - docker_images/ubuntu/Makefile
220
+ - docker_images/windows/Dockerfile
221
+ - docker_images/windows/make.ps1
288
222
  - exe/pdqtest
289
223
  - lib/pdqtest.rb
290
224
  - lib/pdqtest/core.rb
291
225
  - lib/pdqtest/docker.rb
292
226
  - lib/pdqtest/emoji.rb
227
+ - lib/pdqtest/fastcheck.rb
293
228
  - lib/pdqtest/instance.rb
294
- - lib/pdqtest/lint.rb
229
+ - lib/pdqtest/logger.rb
230
+ - lib/pdqtest/pdk.rb
231
+ - lib/pdqtest/pdqtest1x.rb
295
232
  - lib/pdqtest/puppet.rb
296
- - lib/pdqtest/rspec.rb
297
233
  - lib/pdqtest/skeleton.rb
298
- - lib/pdqtest/syntax.rb
299
234
  - lib/pdqtest/upgrade.rb
300
235
  - lib/pdqtest/util.rb
301
236
  - lib/pdqtest/version.rb
302
237
  - pdqtest.gemspec
303
- - res/skeleton/Gemfile
238
+ - res/acceptance/init.bats
239
+ - res/acceptance/init__before.bats
240
+ - res/acceptance/init__setup.sh
241
+ - res/skeleton/.puppet-lint.rc
242
+ - res/skeleton/.travis.yml
304
243
  - res/skeleton/Makefile
305
- - res/skeleton/Rakefile
306
244
  - res/skeleton/bitbucket-pipelines.yml
307
- - res/skeleton/dot_gitignore
308
- - res/skeleton/dot_rspec
309
- - res/skeleton/dot_travis.yml
310
- - res/skeleton/hiera.yaml
311
- - res/skeleton/init.bats
312
- - res/skeleton/init__before.bats
313
- - res/skeleton/init__setup.sh
314
- - res/skeleton/spec_helper.rb
315
- - res/skeleton/test.yaml
245
+ - res/skeleton/make.ps1
246
+ - res/skeleton/spec/fixtures/hiera.yaml
247
+ - res/skeleton/spec/fixtures/hieradata/test.yaml
316
248
  - res/templates/examples_init.pp.erb
317
249
  - res/templates/rspec.rb.erb
318
- homepage: https://github.com/GeoffWilliams/pdqtest
250
+ homepage: https://github.com/DeclarativeSystems/pdqtest
319
251
  licenses:
320
252
  - Apache-2.0
321
253
  metadata: {}
@@ -330,9 +262,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
330
262
  version: '0'
331
263
  required_rubygems_version: !ruby/object:Gem::Requirement
332
264
  requirements:
333
- - - ">="
265
+ - - ">"
334
266
  - !ruby/object:Gem::Version
335
- version: '0'
267
+ version: 1.3.1
336
268
  requirements: []
337
269
  rubyforge_project:
338
270
  rubygems_version: 2.7.6
data/lib/pdqtest/lint.rb DELETED
@@ -1,31 +0,0 @@
1
- require 'pdqtest/emoji'
2
- module PDQTest
3
- module Lint
4
- LINT_PATHS = [
5
- "manifests"
6
- ]
7
-
8
- LINT_OPTIONS = [
9
- "--relative",
10
- "--fail-on-warnings",
11
- "--no-double_quoted_strings-check",
12
- "--no-80chars-check",
13
- "--no-variable_scope-check",
14
- "--no-quoted_booleans-check",
15
- ]
16
- def self.puppet
17
- status = true
18
- LINT_PATHS.each { |p|
19
- if Dir.exists?(p)
20
- if ! system("puppet-lint #{LINT_OPTIONS.join ' '} manifests")
21
- status = false
22
- end
23
- end
24
- }
25
-
26
- PDQTest::Emoji.partial_status(status, 'Linter')
27
- status
28
- end
29
-
30
- end
31
- end
data/lib/pdqtest/rspec.rb DELETED
@@ -1,69 +0,0 @@
1
- require 'pdqtest'
2
- require 'pdqtest/puppet'
3
- require 'pdqtest/util'
4
- require 'pdqtest/emoji'
5
- require 'erb'
6
- require 'fileutils'
7
- require 'pdqtest/util'
8
- require 'json'
9
-
10
-
11
- module PDQTest
12
- module Rspec
13
- SPEC_DIR = './spec'
14
- SPEC_CLASSES_DIR = "#{SPEC_DIR}/classes"
15
- MODULE_CACHE_DIR = "#{Util::app_dir_expanded}/cache/modules"
16
-
17
-
18
- def self.run
19
- if ! Dir.exists?(MODULE_CACHE_DIR)
20
- FileUtils.mkdir_p(MODULE_CACHE_DIR)
21
- end
22
-
23
- status = PDQTest::Puppet.install_modules()
24
-
25
- if status
26
- PDQTest::Puppet.git_fixtures.each { |extra_mod_install_cmd|
27
- if status
28
- cmd = "bundle exec #{extra_mod_install_cmd}"
29
- status &= system(cmd)
30
- end
31
- if ! status
32
- Escort::Logger.error.error "Install git fixtures failed: #{cmd}"
33
- end
34
- }
35
- if status
36
- status &= system("bundle exec rake spec")
37
- end
38
- end
39
- PDQTest::Emoji.partial_status(status, 'RSpec-Puppet')
40
- status
41
- end
42
-
43
- def self.class2specfile(c)
44
- pp = Puppet::class2filename(c)
45
- pp.gsub(Puppet::MANIFESTS_DIR, SPEC_CLASSES_DIR).gsub('.pp', '_spec.rb')
46
- end
47
-
48
- def self.gen_specs
49
- classes = PDQTest::Puppet::find_classes
50
-
51
- classes.each { |classname|
52
- spec_file = class2specfile(classname)
53
- if File.exists?(spec_file)
54
- Escort::Logger.output.puts "Skipped #{classname} - tests already exist at #{spec_file}"
55
- else
56
- # first ensure any nested directories exist
57
- base_dir = File.dirname(spec_file)
58
- if ! Dir.exists?(base_dir)
59
- FileUtils.mkdir_p(base_dir)
60
- end
61
-
62
- # process the rspec template into a new file
63
- PDQTest::Skeleton.install_template(spec_file, 'rspec.rb.erb', {:classname=>classname})
64
- end
65
- }
66
- end
67
-
68
- end
69
- end
@@ -1,20 +0,0 @@
1
- # Ask user to install puppet gem if missing. It's not in the bundle to avoid
2
- # the issue of accidentally installing the puppet gem on a managed node.
3
- # Fixes #21
4
- begin
5
- require 'puppet-syntax/tasks/puppet-syntax'
6
- rescue LoadError
7
- raise "Please install the puppet gem: `gem install puppet`"
8
- end
9
- require 'pdqtest'
10
- require 'pdqtest/emoji'
11
- module PDQTest
12
- module Syntax
13
- def self.puppet
14
- status = system("rake syntax")
15
- PDQTest::Emoji.partial_status(status, 'Syntax')
16
-
17
- status
18
- end
19
- end
20
- end
data/res/skeleton/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
- case RUBY_PLATFORM
3
- when /darwin/
4
- gem 'CFPropertyList'
5
- end
6
- gem 'facter', '2.5.1'
7
- gem 'rspec-puppet-facts', '1.7.0'
@@ -1,3 +0,0 @@
1
- require 'puppetlabs_spec_helper/rake_tasks'
2
- require 'puppet-lint/tasks/puppet-lint'
3
- require 'puppet-syntax/tasks/puppet-syntax'
@@ -1,9 +0,0 @@
1
- /spec/fixtures
2
- Gemfile.lock
3
- Puppetfile.lock
4
- .librarian
5
- .tmp
6
- .yardoc
7
- /pkg
8
- .Puppetfile.pdqtest
9
- .idea
@@ -1,2 +0,0 @@
1
- --color
2
- --format documentation
@@ -1,7 +0,0 @@
1
- ---
2
- :backends:
3
- - yaml
4
- :yaml:
5
- :datadir: 'spec/fixtures/hieradata'
6
- :hierarchy:
7
- - 'test'
@@ -1,4 +0,0 @@
1
- require 'puppetlabs_spec_helper/module_spec_helper'
2
- RSpec.configure do |c|
3
- c.hiera_config = File.expand_path(File.join(__FILE__, '../fixtures/hiera.yaml'))
4
- end
@@ -1,3 +0,0 @@
1
- # test.yaml (for testing)
2
- ---
3
- message: "this is a test message from pdqtest/hiera"