puppet-ci-testing 0.13.1 → 0.15.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 +5 -5
- data/bin/puppet_unittest_workflow +79 -19
- data/etc/puppet_unittest_workflow.yaml +9 -1
- data/lib/check_file_syntax.rb +1 -1
- metadata +21 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 550788cd9c65b34842411b5d7ca976b33f5326ce83c975e0629669c380f76098
|
4
|
+
data.tar.gz: 73aece062fb6d483bae81f8865c8a64da5e346363778d80e8df176de3b3dc9e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e859a8d0a415e0b539a93860f4726e58478070674e09efd56d7af153d8c2cb5e493c83d9c749b55421fa63e92cbbb96478f047fc86f6d1703af62328ad82e29d
|
7
|
+
data.tar.gz: ac2f04edd9ac2b9ad8b8fd732314c6632da606d270f35cd5309adff20ad902cd8ee81135a84b416f1361f277d0e6b4f69690289326b15458b1d1fcbb86e95c2e
|
@@ -8,8 +8,10 @@ require 'rake'
|
|
8
8
|
require 'rspec/core/rake_task'
|
9
9
|
require 'puppetlabs_spec_helper/rake_tasks'
|
10
10
|
require 'puppet-lint/tasks/puppet-lint'
|
11
|
+
require 'metadata-json-lint/rake_task'
|
11
12
|
|
12
13
|
require 'puppet-lint'
|
14
|
+
require 'metadata_json_lint'
|
13
15
|
|
14
16
|
require 'check_file_syntax'
|
15
17
|
|
@@ -32,9 +34,9 @@ def create_fixtures_yml
|
|
32
34
|
if dep.key? 'version_requirement'
|
33
35
|
fix.puts " #{(dep['name'].split(/[\/\-]/))[-1]}:"
|
34
36
|
fix.puts " repo: \"#{dep['name']}\""
|
35
|
-
fix.puts " ref: \"#{dep['version_requirement'].gsub(/[=\<\>~\s]
|
37
|
+
fix.puts " ref: \"#{dep['version_requirement'].gsub(/[=\<\>~\s]+([\d\.]+).*$/, '\1')}\""
|
36
38
|
else
|
37
|
-
fix.puts " #{(dep['name'].split(/\/\-/))[1]}: \"#{dep['name']}\""
|
39
|
+
fix.puts " #{(dep['name'].split(/\/\-/))[-1]}: \"#{dep['name']}\""
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -84,10 +86,10 @@ EOM
|
|
84
86
|
end
|
85
87
|
|
86
88
|
|
87
|
-
def
|
89
|
+
def process_puppet_lint_parsing(opts)
|
88
90
|
|
89
91
|
all_checks = PuppetLint.configuration.checks.map {|chk| chk.to_s}
|
90
|
-
enables = opts.
|
92
|
+
enables = opts.puppet_lint_enable.empty? ? all_checks : opts.puppet_lint_enable
|
91
93
|
disables = all_checks - enables
|
92
94
|
|
93
95
|
puts <<-EOM
|
@@ -95,7 +97,7 @@ def process_lint_parsing(opts)
|
|
95
97
|
========================================================================
|
96
98
|
========================================================================
|
97
99
|
|
98
|
-
Performing lint parsing
|
100
|
+
Performing puppet manifest lint parsing
|
99
101
|
|
100
102
|
Enabled lint options:
|
101
103
|
#{enables.join("\n ")}
|
@@ -109,7 +111,7 @@ EOM
|
|
109
111
|
Rake::Task['lint'].clear
|
110
112
|
PuppetLint::RakeTask.new :lint do |config|
|
111
113
|
config.ignore_paths = ['spec/**/*.pp', 'vendor/**/*.pp']
|
112
|
-
config.log_format = '%{path}:%{
|
114
|
+
config.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
|
113
115
|
config.fail_on_warnings = false
|
114
116
|
config.disable_checks = disables
|
115
117
|
end
|
@@ -136,6 +138,51 @@ EOM
|
|
136
138
|
end
|
137
139
|
|
138
140
|
|
141
|
+
def process_metadata_lint_parsing(opts)
|
142
|
+
|
143
|
+
all_checks = MetadataJsonLint.options.members.select {|check| check.to_s if check != :format }
|
144
|
+
enables = opts.metadata_lint_enable.empty? ? all_checks : opts.metadata_lint_enable
|
145
|
+
disables = all_checks - enables
|
146
|
+
|
147
|
+
puts <<-EOM
|
148
|
+
|
149
|
+
========================================================================
|
150
|
+
========================================================================
|
151
|
+
|
152
|
+
Performing metadata.json lint parsing
|
153
|
+
|
154
|
+
Enabled lint options:
|
155
|
+
#{enables.join("\n ")}
|
156
|
+
|
157
|
+
************************************************************************
|
158
|
+
|
159
|
+
EOM
|
160
|
+
|
161
|
+
# configure the rake task to disable specific checks
|
162
|
+
enables.each {|check| MetadataJsonLint.options[check] = true }
|
163
|
+
disables.each {|check| MetadataJsonLint.options[check] = false}
|
164
|
+
|
165
|
+
begin
|
166
|
+
# TODO: gather lint output and generate JUnit reports
|
167
|
+
Rake.application['metadata_lint'].invoke
|
168
|
+
rescue SystemExit => e
|
169
|
+
puts <<-EOM
|
170
|
+
|
171
|
+
************************************************************************
|
172
|
+
|
173
|
+
BUILD HAS FAILED
|
174
|
+
|
175
|
+
Correct the above metadata.json LINT errors to correct
|
176
|
+
|
177
|
+
************************************************************************
|
178
|
+
|
179
|
+
EOM
|
180
|
+
return false
|
181
|
+
end
|
182
|
+
return true
|
183
|
+
end
|
184
|
+
|
185
|
+
|
139
186
|
def process_rspec_tests(opts)
|
140
187
|
|
141
188
|
puts <<-EOM
|
@@ -180,29 +227,36 @@ options = OpenStruct.new
|
|
180
227
|
options.syntax_run = true
|
181
228
|
options.syntax_checks = CheckFileSyntax::ALL_CHECKS
|
182
229
|
options.syntax_exclude_dirs = []
|
183
|
-
options.
|
184
|
-
options.
|
230
|
+
options.puppet_lint_run = true
|
231
|
+
options.puppet_lint_enable = []
|
232
|
+
options.metadata_lint_run = true
|
233
|
+
options.metadata_lint_enable = []
|
185
234
|
options.rspec_run = true
|
186
235
|
options.rspec_clean_sources = false
|
187
236
|
|
188
237
|
|
189
238
|
# read in config file and set options
|
190
239
|
defaults = YAML.load_file(CONF_FILE)
|
191
|
-
defaults.keys.each do |
|
192
|
-
opts = defaults[
|
240
|
+
defaults.keys.each do |test_type|
|
241
|
+
opts = defaults[test_type]
|
193
242
|
|
194
|
-
if
|
243
|
+
if test_type == 'syntax'
|
195
244
|
options.syntax_run = opts['run'] if opts.has_key? 'run'
|
196
245
|
options.syntax_checks = opts['checks'] if opts.has_key? 'checks'
|
197
246
|
options.syntax_exclude_dirs = opts['exclude_dirs'] if opts.has_key? 'exclude_dirs'
|
198
247
|
end
|
199
248
|
|
200
|
-
if
|
201
|
-
options.
|
202
|
-
options.
|
249
|
+
if test_type == 'puppet_lint'
|
250
|
+
options.puppet_lint_run = opts['run'] if opts.has_key? 'run'
|
251
|
+
options.puppet_lint_enable = opts['enable'] if opts.has_key? 'enable'
|
203
252
|
end
|
204
253
|
|
205
|
-
if
|
254
|
+
if test_type == 'metadata_lint'
|
255
|
+
options.metadata_lint_run = opts['run'] if opts.has_key? 'run'
|
256
|
+
options.metadata_lint_enable = opts['enable'] if opts.has_key? 'enable'
|
257
|
+
end
|
258
|
+
|
259
|
+
if test_type == 'rspec'
|
206
260
|
options.rspec_run = opts['run'] if opts.has_key? 'run'
|
207
261
|
options.rspec_clean_sources = opts['clean_sources'] if opts.has_key? 'clean_sources'
|
208
262
|
end
|
@@ -212,8 +266,9 @@ end
|
|
212
266
|
|
213
267
|
# process the command line options and override prev set settings
|
214
268
|
OptionParser.new do |opts|
|
215
|
-
opts.on('--[no-]lint', "Enable/disable lint parsing (Default: #{options[:
|
216
|
-
options.
|
269
|
+
opts.on('--[no-]lint', "Enable/disable lint parsing (Default: #{options[:puppet_lint_run]})") do |val|
|
270
|
+
options.puppet_lint_run = val
|
271
|
+
options.metadata_lint_run = val
|
217
272
|
end
|
218
273
|
|
219
274
|
opts.on('--disable-syntax-check [TYPE]', 'Disable syntax check for TYPE') do |val|
|
@@ -267,12 +322,17 @@ if options.syntax_run
|
|
267
322
|
end
|
268
323
|
|
269
324
|
|
270
|
-
if options.
|
271
|
-
unless
|
325
|
+
if options.puppet_lint_run
|
326
|
+
unless process_puppet_lint_parsing(options)
|
272
327
|
exit(2)
|
273
328
|
end
|
274
329
|
end
|
275
330
|
|
331
|
+
if options.metadata_lint_run
|
332
|
+
unless process_metadata_lint_parsing(options)
|
333
|
+
exit(2)
|
334
|
+
end
|
335
|
+
end
|
276
336
|
|
277
337
|
if options.rspec_run
|
278
338
|
process_rspec_tests(options)
|
@@ -16,7 +16,7 @@
|
|
16
16
|
- spec
|
17
17
|
#
|
18
18
|
# Configuration for lint parsing
|
19
|
-
|
19
|
+
puppet_lint:
|
20
20
|
run: true
|
21
21
|
# enable turns on lint parsing options. They are puppet-lint options
|
22
22
|
# with '--no-' and '-check' removed from the option. Not specifying
|
@@ -55,6 +55,14 @@
|
|
55
55
|
- ensure_not_symlink_target
|
56
56
|
- unquoted_node_name
|
57
57
|
#
|
58
|
+
# Configuration for metadata.json linting
|
59
|
+
metadata_lint:
|
60
|
+
run: true
|
61
|
+
enable:
|
62
|
+
# - strict_dependencies
|
63
|
+
- strict_license
|
64
|
+
- fail_on_warnings
|
65
|
+
#
|
58
66
|
# Configuration for RSpec unit testing
|
59
67
|
rspec:
|
60
68
|
run: true
|
data/lib/check_file_syntax.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-ci-testing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerard Hickey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet
|
@@ -123,19 +123,33 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: metadata-json-lint
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
-
type: :
|
131
|
+
version: 2.0.2
|
132
|
+
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 2.0.2
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 12.3.3
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 12.3.3
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: rspec
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,8 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
227
|
- !ruby/object:Gem::Version
|
214
228
|
version: '0'
|
215
229
|
requirements: []
|
216
|
-
|
217
|
-
rubygems_version: 2.4.8
|
230
|
+
rubygems_version: 3.0.4
|
218
231
|
signing_key:
|
219
232
|
specification_version: 4
|
220
233
|
summary: Utilities to perform Puppet testing in a CI workflow
|