puppet-ci-testing 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/puppet_unittest_workflow +82 -19
- data/etc/puppet_unittest_workflow.yaml +8 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a15e41bb841658e3fe748133fcaa99b1dc561a8
|
4
|
+
data.tar.gz: 9afe63589635e31e960081b7aacf67ccb776a2b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa6a0b2d99121334e809c99600d14fc3de3d0e21de37ac2b4b35b69f2d46a6d05713332cbb87b68b195be46d2c244f855618b8535a492b67d880dcade374f6cf
|
7
|
+
data.tar.gz: d69ea762c8f9da29089d8613835438bb3775aef2194fbbd56671f45a99dfe4bdde96d88fdf38f02e2146c07b2b54fb7dfcdd3509abfb5d4155cef8b7c3a18170
|
@@ -32,9 +32,9 @@ def create_fixtures_yml
|
|
32
32
|
if dep.key? 'version_requirement'
|
33
33
|
fix.puts " #{(dep['name'].split(/[\/\-]/))[-1]}:"
|
34
34
|
fix.puts " repo: \"#{dep['name']}\""
|
35
|
-
fix.puts " ref: \"#{dep['version_requirement'].gsub(/[=\<\>~\s]
|
35
|
+
fix.puts " ref: \"#{dep['version_requirement'].gsub(/[=\<\>~\s]+([\d\.]+).*$/, '\1')}\""
|
36
36
|
else
|
37
|
-
fix.puts " #{(dep['name'].split(/\/\-/))[1]}: \"#{dep['name']}\""
|
37
|
+
fix.puts " #{(dep['name'].split(/\/\-/))[-1]}: \"#{dep['name']}\""
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -84,10 +84,10 @@ EOM
|
|
84
84
|
end
|
85
85
|
|
86
86
|
|
87
|
-
def
|
87
|
+
def process_puppet_lint_parsing(opts)
|
88
88
|
|
89
89
|
all_checks = PuppetLint.configuration.checks.map {|chk| chk.to_s}
|
90
|
-
enables = opts.
|
90
|
+
enables = opts.puppet_lint_enable || all_checks
|
91
91
|
disables = all_checks - enables
|
92
92
|
|
93
93
|
puts <<-EOM
|
@@ -95,7 +95,7 @@ def process_lint_parsing(opts)
|
|
95
95
|
========================================================================
|
96
96
|
========================================================================
|
97
97
|
|
98
|
-
Performing lint parsing
|
98
|
+
Performing puppet manifest lint parsing
|
99
99
|
|
100
100
|
Enabled lint options:
|
101
101
|
#{enables.join("\n ")}
|
@@ -109,7 +109,7 @@ EOM
|
|
109
109
|
Rake::Task['lint'].clear
|
110
110
|
PuppetLint::RakeTask.new :lint do |config|
|
111
111
|
config.ignore_paths = ['spec/**/*.pp', 'vendor/**/*.pp']
|
112
|
-
config.log_format = '%{path}:%{
|
112
|
+
config.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
|
113
113
|
config.fail_on_warnings = false
|
114
114
|
config.disable_checks = disables
|
115
115
|
end
|
@@ -136,6 +136,56 @@ EOM
|
|
136
136
|
end
|
137
137
|
|
138
138
|
|
139
|
+
def process_metadata_lint_parsing(opts)
|
140
|
+
|
141
|
+
all_checks = MetadataJsonLint.options.members.select {|check| check.to_s if check != :format }
|
142
|
+
enables = opts.metadata_lint_enable || all_checks
|
143
|
+
disables = all_checks - enables
|
144
|
+
|
145
|
+
puts <<-EOM
|
146
|
+
|
147
|
+
========================================================================
|
148
|
+
========================================================================
|
149
|
+
|
150
|
+
Performing metadata.json lint parsing
|
151
|
+
|
152
|
+
Enabled lint options:
|
153
|
+
#{enables.join("\n ")}
|
154
|
+
|
155
|
+
************************************************************************
|
156
|
+
|
157
|
+
EOM
|
158
|
+
|
159
|
+
# configure the rake task to disable specific checks
|
160
|
+
if not disables.empty?
|
161
|
+
Rake::Task['lint'].clear
|
162
|
+
MetadataJsonLint::RakeTask.new :lint do |config|
|
163
|
+
enables.each {|check| config[check] = true }
|
164
|
+
disables.each {|check| config[check] = false }
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
begin
|
169
|
+
# TODO: gather lint output and generate JUnit reports
|
170
|
+
Rake.application['lint'].invoke
|
171
|
+
rescue SystemExit => e
|
172
|
+
puts <<-EOM
|
173
|
+
|
174
|
+
************************************************************************
|
175
|
+
|
176
|
+
BUILD HAS FAILED
|
177
|
+
|
178
|
+
Correct the above metadata.json LINT errors to correct
|
179
|
+
|
180
|
+
************************************************************************
|
181
|
+
|
182
|
+
EOM
|
183
|
+
return false
|
184
|
+
end
|
185
|
+
return true
|
186
|
+
end
|
187
|
+
|
188
|
+
|
139
189
|
def process_rspec_tests(opts)
|
140
190
|
|
141
191
|
puts <<-EOM
|
@@ -180,29 +230,36 @@ options = OpenStruct.new
|
|
180
230
|
options.syntax_run = true
|
181
231
|
options.syntax_checks = CheckFileSyntax::ALL_CHECKS
|
182
232
|
options.syntax_exclude_dirs = []
|
183
|
-
options.
|
184
|
-
options.
|
233
|
+
options.puppet_lint_run = true
|
234
|
+
options.puppet_lint_enable = []
|
235
|
+
options.metadata_lint_run = true
|
236
|
+
options.metadata_lint_enable = []
|
185
237
|
options.rspec_run = true
|
186
238
|
options.rspec_clean_sources = false
|
187
239
|
|
188
240
|
|
189
241
|
# read in config file and set options
|
190
242
|
defaults = YAML.load_file(CONF_FILE)
|
191
|
-
defaults.keys.each do |
|
192
|
-
opts = defaults[
|
243
|
+
defaults.keys.each do |test_type|
|
244
|
+
opts = defaults[test_type]
|
193
245
|
|
194
|
-
if
|
246
|
+
if test_type == 'syntax'
|
195
247
|
options.syntax_run = opts['run'] if opts.has_key? 'run'
|
196
248
|
options.syntax_checks = opts['checks'] if opts.has_key? 'checks'
|
197
249
|
options.syntax_exclude_dirs = opts['exclude_dirs'] if opts.has_key? 'exclude_dirs'
|
198
250
|
end
|
199
251
|
|
200
|
-
if
|
201
|
-
options.
|
202
|
-
options.
|
252
|
+
if test_type == 'puppet_lint'
|
253
|
+
options.puppet_lint_run = opts['run'] if opts.has_key? 'run'
|
254
|
+
options.puppet_lint_enable = opts['enable'] if opts.has_key? 'enable'
|
203
255
|
end
|
204
256
|
|
205
|
-
if
|
257
|
+
if test_type == 'metadata_lint'
|
258
|
+
options.metadata_lint_run = opts['run'] if opts.has_key? 'run'
|
259
|
+
options.metadata_lint_enable = opts['enable'] if opts.has_key? 'enable'
|
260
|
+
end
|
261
|
+
|
262
|
+
if test_type == 'rspec'
|
206
263
|
options.rspec_run = opts['run'] if opts.has_key? 'run'
|
207
264
|
options.rspec_clean_sources = opts['clean_sources'] if opts.has_key? 'clean_sources'
|
208
265
|
end
|
@@ -212,8 +269,9 @@ end
|
|
212
269
|
|
213
270
|
# process the command line options and override prev set settings
|
214
271
|
OptionParser.new do |opts|
|
215
|
-
opts.on('--[no-]lint', "Enable/disable lint parsing (Default: #{options[:
|
216
|
-
options.
|
272
|
+
opts.on('--[no-]lint', "Enable/disable lint parsing (Default: #{options[:puppet_lint_run]})") do |val|
|
273
|
+
options.puppet_lint_run = val
|
274
|
+
options.metadata_lint_run = val
|
217
275
|
end
|
218
276
|
|
219
277
|
opts.on('--disable-syntax-check [TYPE]', 'Disable syntax check for TYPE') do |val|
|
@@ -267,12 +325,17 @@ if options.syntax_run
|
|
267
325
|
end
|
268
326
|
|
269
327
|
|
270
|
-
if options.
|
271
|
-
unless
|
328
|
+
if options.puppet_lint_run
|
329
|
+
unless process_puppet_lint_parsing(options)
|
272
330
|
exit(2)
|
273
331
|
end
|
274
332
|
end
|
275
333
|
|
334
|
+
if options.metadata_lint_run
|
335
|
+
unless process_metadata_lint_parsing(options)
|
336
|
+
exit(2)
|
337
|
+
end
|
338
|
+
end
|
276
339
|
|
277
340
|
if options.rspec_run
|
278
341
|
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,13 @@
|
|
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
|
58
65
|
# Configuration for RSpec unit testing
|
59
66
|
rspec:
|
60
67
|
run: true
|
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.14.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
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: metadata-json-lint
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.0.2
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.0.2
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: rake
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|