puppetlabs_spec_helper 6.0.1 → 7.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9697b23b7652cc4dd9158675666a7f64ea3a902a4ec8367977712b9549e94951
4
- data.tar.gz: e1913dfc25f36d2067d4f9003810e5d0602a105b2442aaca1bba8a09dff484bb
3
+ metadata.gz: 6188f4bcefb0c6466202ed84d9a4a13b0ebdace7885c8d78da307d135ab7eca6
4
+ data.tar.gz: 46b8356e53ec07eb3073e1ddb1a08eeb5423f6efee7d40ae12fd904de05d7614
5
5
  SHA512:
6
- metadata.gz: e3ee3dbfac1577f1933f00e9b2cb6ac5fb2b4162054b9e9dcedd5921c7cbdcd279dce6294db6ec9cf29919c572ab0087ff62b3175ad1b3ddb24c8d261553587b
7
- data.tar.gz: a0c034d5006429965a0a86a96de2011f708f9ce32893d2518dc6e062c73644560d6651f071c58a7c3d20c91e8013af46c45f14ea1cec7d61ff77beb52f05a0d3
6
+ metadata.gz: abe28cf72356674ee59c2d759e4def9b3bd424f2d8ea3034109834985bc9d3cecde412a6186eb1690a110f1b1b56b9f3159ae8f2387ef88bb1e328942ed6ee19
7
+ data.tar.gz: cba65825d5c9be5b64bf1898396ab949f6b2426c714d5113a12672727d405a89239f5825d7dde208bfeb6a4fdbac20e45fd2e7f1687574c55688bbe9e04a731a
data/.rubocop.yml CHANGED
@@ -17,3 +17,6 @@ AllCops:
17
17
  # Disabled
18
18
  Style/ClassAndModuleChildren:
19
19
  Enabled: false
20
+
21
+ Layout/LineLength:
22
+ Max: 200
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Puppet Labs Spec Helper
2
2
  =======================
3
3
 
4
+ [![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/main/CODEOWNERS)
5
+ ![ci](https://github.com/puppetlabs/puppetlabs_spec_helper/actions/workflows/ci.yml/badge.svg)
6
+ ![GitHub release (latest by date)](https://img.shields.io/github/v/release/puppetlabs/puppetlabs_spec_helper)
7
+
4
8
  The Short Version
5
9
  -----------------
6
10
 
@@ -230,8 +234,8 @@ Add `firewall` and `stdlib` as required module fixtures:
230
234
  ```yaml
231
235
  fixtures:
232
236
  repositories:
233
- firewall: "git://github.com/puppetlabs/puppetlabs-firewall"
234
- stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib"
237
+ firewall: "https://github.com/puppetlabs/puppetlabs-firewall.git"
238
+ stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
235
239
  ```
236
240
 
237
241
  Put a supplementary repository at a different location
@@ -239,8 +243,8 @@ Put a supplementary repository at a different location
239
243
  ```yaml
240
244
  fixtures:
241
245
  repositories:
242
- firewall: "git://github.com/puppetlabs/puppetlabs-firewall"
243
- stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib"
246
+ firewall: "https://github.com/puppetlabs/puppetlabs-firewall.git"
247
+ stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
244
248
  control_repo:
245
249
  repo: "https://github.com/puppetlabs/control-repo"
246
250
  target: "spec/fixtures/control_repos"
@@ -251,9 +255,9 @@ Specify that the git tag `2.4.2` of `stdlib` should be checked out:
251
255
  ```yaml
252
256
  fixtures:
253
257
  repositories:
254
- firewall: "git://github.com/puppetlabs/puppetlabs-firewall"
258
+ firewall: "https://github.com/puppetlabs/puppetlabs-firewall.git"
255
259
  stdlib:
256
- repo: "git://github.com/puppetlabs/puppetlabs-stdlib"
260
+ repo: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
257
261
  ref: "2.6.0"
258
262
  ```
259
263
 
@@ -263,7 +267,7 @@ Only install the `yumrepo_core` module when testing against Puppet 7 or greater:
263
267
  fixtures:
264
268
  repositories:
265
269
  yumrepo_core:
266
- repo: "git://github.com/puppetlabs/puppetlabs-yumrepo_core"
270
+ repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git"
267
271
  puppet_version: ">= 6.0.0"
268
272
  ```
269
273
 
@@ -273,7 +277,7 @@ Move manifests and siblings to root directory when they are inside a `code` dire
273
277
  fixtures:
274
278
  repositories:
275
279
  stdlib:
276
- repo: "git://github.com/puppetlabs/puppetlabs-extradirectory"
280
+ repo: "https://github.com/puppetlabs/puppetlabs-extradirectory.git"
277
281
  subdir: "code"
278
282
  ```
279
283
 
@@ -299,7 +303,7 @@ fixtures:
299
303
  flags: "--module_repository https://my_repo.com"
300
304
  repositories:
301
305
  firewall:
302
- repo: "git://github.com/puppetlabs/puppetlabs-firewall"
306
+ repo: "https://github.com/puppetlabs/puppetlabs-firewall.git"
303
307
  ref: "2.6.0"
304
308
  flags: "--verbose"
305
309
  ```
@@ -317,7 +321,7 @@ fixtures:
317
321
  ref: "2.6.0"
318
322
  repositories:
319
323
  firewall:
320
- repo: "git://github.com/puppetlabs/puppetlabs-firewall"
324
+ repo: "https://github.com/puppetlabs/puppetlabs-firewall.git"
321
325
  ref: "2.6.0"
322
326
  ```
323
327
 
@@ -406,7 +410,7 @@ You can enable it, set the following environment variable:s
406
410
 
407
411
  ``SIMPLECOV=yes``
408
412
 
409
- Remember to add the simplecov-console and codecov gems to your `Gemfile`. If you run `spec:simplecov` on Travis-CI or any of the other supported CI services, reports gets automatically uploaded to https://codecov.io/ .
413
+ Remember to add the simplecov-console gem to your `Gemfile`. If you run `spec:simplecov` on Travis-CI or any of the other supported CI services, reports get generated which can then be uploaded to [codecov.io](https://codecov.io) with the recommended [codecov uploader](https://docs.codecov.com/docs/codecov-uploader).
410
414
 
411
415
  Some Notes for Windows Users
412
416
  ============================
@@ -481,3 +485,7 @@ Rationale
481
485
  * mocha is an additional dependency to carry.
482
486
 
483
487
  EOF
488
+
489
+ ## License
490
+
491
+ This codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT.
@@ -20,35 +20,42 @@ env_module_path = ENV.fetch('MODULEPATH', nil)
20
20
  module_path = File.join(fixture_path, 'modules')
21
21
 
22
22
  module_path = [module_path, env_module_path].join(File::PATH_SEPARATOR) if env_module_path
23
+
23
24
  if ENV['SIMPLECOV'] == 'yes'
24
25
  begin
25
26
  require 'simplecov'
26
27
  require 'simplecov-console'
28
+ rescue LoadError
29
+ raise 'Add the simplecov and simplecov-console gems to Gemfile to enable this task'
30
+ end
31
+
32
+ SimpleCov.formatters = [
33
+ SimpleCov::Formatter::HTMLFormatter,
34
+ SimpleCov::Formatter::Console
35
+ ]
36
+
37
+ begin
27
38
  require 'codecov'
39
+ SimpleCov.formatters << SimpleCov::Formatter::Codecov
40
+ rescue LoadError
41
+ # continue without codecov, we could warn here but we want to avoid its use if possible
42
+ end
43
+
44
+ SimpleCov.start do
45
+ track_files 'lib/**/*.rb'
46
+ add_filter '/spec'
28
47
 
29
- SimpleCov.formatters = [
30
- SimpleCov::Formatter::HTMLFormatter,
31
- SimpleCov::Formatter::Console,
32
- SimpleCov::Formatter::Codecov
33
- ]
34
- SimpleCov.start do
35
- track_files 'lib/**/*.rb'
36
- add_filter '/spec'
37
-
38
- # do not track vendored files
39
- add_filter '/vendor'
40
- add_filter '/.vendor'
41
-
42
- # do not track gitignored files
43
- # this adds about 4 seconds to the coverage check
44
- # this could definitely be optimized
45
- add_filter do |f|
46
- # system returns true if exit status is 0, which with git-check-ignore means file is ignored
47
- system("git check-ignore --quiet #{f.filename}")
48
- end
48
+ # do not track vendored files
49
+ add_filter '/vendor'
50
+ add_filter '/.vendor'
51
+
52
+ # do not track gitignored files
53
+ # this adds about 4 seconds to the coverage check
54
+ # this could definitely be optimized
55
+ add_filter do |f|
56
+ # system returns true if exit status is 0, which with git-check-ignore means file is ignored
57
+ system("git check-ignore --quiet #{f.filename}")
49
58
  end
50
- rescue LoadError
51
- raise 'Add the simplecov, simplecov-console, codecov gems to Gemfile to enable this task'
52
59
  end
53
60
  end
54
61
 
@@ -58,7 +65,7 @@ components = module_path.split(File::PATH_SEPARATOR).map do |dir|
58
65
 
59
66
  Dir.entries(dir).grep_v(/^\./).map { |f| File.join(dir, f, 'spec', 'lib') }
60
67
  end
61
- components.flatten.each do |d|
68
+ components.compact.flatten.each do |d|
62
69
  $LOAD_PATH << d if FileTest.directory?(d) && !$LOAD_PATH.include?(d)
63
70
  end
64
71
 
@@ -67,7 +74,6 @@ RSpec.configure do |c|
67
74
 
68
75
  c.environmentpath = spec_path
69
76
  c.module_path = module_path
70
- c.manifest_dir = File.join(fixture_path, 'manifests')
71
77
 
72
78
  # https://github.com/puppetlabs/rspec-puppet#strict_variables
73
79
  c.strict_variables = ENV['STRICT_VARIABLES'] != 'no'
@@ -46,9 +46,8 @@ end
46
46
  task default: [:help]
47
47
 
48
48
  pattern = 'spec/{aliases,classes,defines,functions,hosts,integration,plans,tasks,type_aliases,types,unit}/**/*_spec.rb'
49
-
50
49
  RSpec::Core::RakeTask.new(:spec_standalone) do |t, args|
51
- t.rspec_opts = []
50
+ t.rspec_opts = ['--format', 'documentation', '--color']
52
51
  t.rspec_opts << ENV['CI_SPEC_OPTIONS'] unless ENV['CI_SPEC_OPTIONS'].nil?
53
52
  if ENV['CI_NODE_TOTAL'] && ENV['CI_NODE_INDEX']
54
53
  ci_total = ENV['CI_NODE_TOTAL'].to_i
@@ -111,8 +110,9 @@ task :parallel_spec_standalone do |_t, args|
111
110
  warn 'No files for parallel_spec to run against'
112
111
  else
113
112
 
114
- args = ['-t', 'rspec']
115
- args.push('--').concat(ENV['CI_SPEC_OPTIONS'].strip.split).push('--') unless ENV['CI_SPEC_OPTIONS'].nil? || ENV['CI_SPEC_OPTIONS'].strip.empty?
113
+ args = ['--type', 'rspec']
114
+ additional_options = ['--format', 'progress'] + ENV['CI_SPEC_OPTIONS'].to_s.strip.split
115
+ args.push('--').concat(additional_options).push('--')
116
116
  args.concat(Rake::FileList[pattern].to_a)
117
117
 
118
118
  ParallelTests::CLI.new.run(args)
@@ -176,7 +176,7 @@ puppet_lint_disable_checks = %w[
176
176
  ]
177
177
 
178
178
  puppet_lint_disable_checks.each do |check|
179
- PuppetLint.configuration.send("disable_#{check}")
179
+ PuppetLint.configuration.send(:"disable_#{check}")
180
180
  end
181
181
  PuppetLint::RakeTask.new(:lint)
182
182
 
@@ -191,7 +191,8 @@ PuppetSyntax.exclude_paths << 'spec/fixtures/**/*'
191
191
  PuppetSyntax.exclude_paths << 'pkg/**/*'
192
192
  PuppetSyntax.exclude_paths << 'vendor/**/*'
193
193
  PuppetSyntax.exclude_paths << '.vendor/**/*'
194
- PuppetSyntax.exclude_paths << 'plans/**/*'
194
+ PuppetSyntax.check_hiera_keys = true
195
+ PuppetSyntax.check_hiera_data = true
195
196
 
196
197
  desc 'Check syntax of Ruby files and call :syntax and :metadata_lint'
197
198
  task :validate do
@@ -106,8 +106,7 @@ module PuppetlabsSpecHelper
106
106
  end
107
107
 
108
108
  fixtures = fixtures['fixtures']
109
-
110
- fixtures['symlinks'] = auto_symlink if fixtures['symlinks'].nil?
109
+ fixtures['symlinks'] = fixtures['symlinks'].nil? || fixtures['symlinks'].empty? ? auto_symlink : auto_symlink.merge!(fixtures['symlinks'])
111
110
 
112
111
  result = {}
113
112
  if fixtures.include?(category) && !fixtures[category].nil?
@@ -151,7 +150,7 @@ module PuppetlabsSpecHelper
151
150
  return hash unless hash['scm'] == 'git'
152
151
 
153
152
  # Forward slashes in the ref aren't allowed. And is probably a branch name.
154
- raise ArgumentError, "The ref for #{hash['target']} is invalid (Contains a forward slash). If this is a branch name, please use the 'branch' setting instead." if hash['ref'].include?('/')
153
+ raise ArgumentError, "The ref for #{hash['target']} is invalid (Contains a forward slash). If this is a branch name, please use the 'branch' setting instead." if hash['ref']&.include?('/')
155
154
 
156
155
  hash
157
156
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetlabsSpecHelper
4
- VERSION = '6.0.1'
4
+ VERSION = '7.3.0'
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  if ENV['COVERAGE'] == 'yes'
4
- require 'simplecov'
5
- require 'simplecov-console'
6
- require 'codecov'
4
+ begin
5
+ require 'simplecov'
6
+ require 'simplecov-console'
7
+ rescue LoadError
8
+ raise 'Add the simplecov and simplecov-console gems to Gemfile to enable this task'
9
+ end
7
10
 
8
11
  SimpleCov.formatters = [
9
12
  SimpleCov::Formatter::HTMLFormatter,
10
- SimpleCov::Formatter::Console,
11
- SimpleCov::Formatter::Codecov
13
+ SimpleCov::Formatter::Console
12
14
  ]
15
+
13
16
  SimpleCov.start do
14
17
  track_files 'lib/**/*.rb'
15
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetlabs_spec_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 7.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-04-25 00:00:00.000000000 Z
12
+ date: 2024-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -49,30 +49,36 @@ dependencies:
49
49
  name: puppet-lint
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.0
54
+ version: '4.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.0
61
+ version: '4.0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: puppet-syntax
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: '4.1'
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 4.1.1
69
72
  type: :runtime
70
73
  prerelease: false
71
74
  version_requirements: !ruby/object:Gem::Requirement
72
75
  requirements:
73
76
  - - "~>"
74
77
  - !ruby/object:Gem::Version
75
- version: '3.0'
78
+ version: '4.1'
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 4.1.1
76
82
  - !ruby/object:Gem::Dependency
77
83
  name: rspec-github
78
84
  requirement: !ruby/object:Gem::Requirement
@@ -91,16 +97,16 @@ dependencies:
91
97
  name: rspec-puppet
92
98
  requirement: !ruby/object:Gem::Requirement
93
99
  requirements:
94
- - - ">="
100
+ - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: '2.0'
102
+ version: '4.0'
97
103
  type: :runtime
98
104
  prerelease: false
99
105
  version_requirements: !ruby/object:Gem::Requirement
100
106
  requirements:
101
- - - ">="
107
+ - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: '2.0'
109
+ version: '4.0'
104
110
  description: Contains rake tasks and a standard spec_helper for running spec tests
105
111
  on puppet modules.
106
112
  email: