puppetlabs_spec_helper 7.0.1 → 8.0.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/.rubocop.yml +6 -13
- data/README.md +12 -1
- data/lib/puppetlabs_spec_helper/module_spec_helper.rb +30 -23
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb +1 -1
- data/lib/puppetlabs_spec_helper/rake_tasks.rb +10 -38
- data/lib/puppetlabs_spec_helper/tasks/check_symlinks.rb +2 -2
- data/lib/puppetlabs_spec_helper/tasks/fixtures.rb +9 -7
- data/lib/puppetlabs_spec_helper/version.rb +1 -1
- data/spec/spec_helper.rb +7 -4
- data/spec/unit/puppetlabs_spec_helper/tasks/check_symlinks_spec.rb +13 -13
- data/spec/unit/puppetlabs_spec_helper/tasks/check_test_file_spec.rb +1 -1
- data/spec/unit/puppetlabs_spec_helper/tasks/fixture_helpers_spec.rb +39 -16
- data/spec/watchr.rb +1 -1
- metadata +36 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6e4f387a2e5ca2ffdaf54834dba59bddbc793d099a32844e406d6bcf1906345
|
|
4
|
+
data.tar.gz: a5d37de14da8a64547e4dd3a40a649b0eac66d7c73d7d2aff561dafc569c3299
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c5d1c7bc0f185b696570c75bccab95349681e09bc213e91f5ffeb855d462a4e98c30cc3049ccb44cb083936438ccc386bcee6096a92f2ff8e8eb48c1fc8478e
|
|
7
|
+
data.tar.gz: 7da07d5ea2f8c277944bb803765fe2a39695c38ee3342bf0da34fdefce301e20edce6d9a201337db7cbbb14536ac2f9894cb50925f439a6214f9aa1a35669b97
|
data/.rubocop.yml
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
+
---
|
|
1
2
|
inherit_from: .rubocop_todo.yml
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
- rubocop
|
|
5
|
-
- rubocop-rspec
|
|
6
|
-
|
|
7
|
-
AllCops:
|
|
8
|
-
Exclude:
|
|
9
|
-
- Gemfile
|
|
10
|
-
- Rakefile
|
|
11
|
-
- spec/fixtures/**/*
|
|
12
|
-
- vendor/bundle/**/*
|
|
13
|
-
NewCops: enable
|
|
14
|
-
SuggestExtensions: false
|
|
15
|
-
TargetRubyVersion: '2.7'
|
|
4
|
+
inherit_gem:
|
|
5
|
+
voxpupuli-rubocop: rubocop.yml
|
|
16
6
|
|
|
17
7
|
# Disabled
|
|
18
8
|
Style/ClassAndModuleChildren:
|
|
19
9
|
Enabled: false
|
|
10
|
+
|
|
11
|
+
Layout/LineLength:
|
|
12
|
+
Max: 200
|
data/README.md
CHANGED
|
@@ -216,6 +216,17 @@ When specifying the repo source of the fixture you have a few options as to whic
|
|
|
216
216
|
* `ref` and `branch` can be used together to get a specific revision on a specific branch
|
|
217
217
|
* Top level `defaults` option could be used to set global options
|
|
218
218
|
|
|
219
|
+
Using Forge Authorization
|
|
220
|
+
-----------------
|
|
221
|
+
|
|
222
|
+
In order to perform forge operations which require authorization, such as installing premium modules, you can export your forge api key as an environment variable in your terminal.
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
FORGE_API_KEY='your_api_key'
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
puppetlabs_spec_helper will then automatically append this key to all `puppet module install` requests when running `rake spec_prep`.
|
|
229
|
+
|
|
219
230
|
Fixtures Examples
|
|
220
231
|
-----------------
|
|
221
232
|
Basic fixtures that will symlink `spec/fixtures/modules/my_modules` to the
|
|
@@ -410,7 +421,7 @@ You can enable it, set the following environment variable:s
|
|
|
410
421
|
|
|
411
422
|
``SIMPLECOV=yes``
|
|
412
423
|
|
|
413
|
-
Remember to add the simplecov-console
|
|
424
|
+
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).
|
|
414
425
|
|
|
415
426
|
Some Notes for Windows Users
|
|
416
427
|
============================
|
|
@@ -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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
|
@@ -111,8 +111,9 @@ task :parallel_spec_standalone do |_t, args|
|
|
|
111
111
|
warn 'No files for parallel_spec to run against'
|
|
112
112
|
else
|
|
113
113
|
|
|
114
|
-
args = ['
|
|
115
|
-
|
|
114
|
+
args = ['--type', 'rspec']
|
|
115
|
+
additional_options = ['--format', 'progress'] + ENV['CI_SPEC_OPTIONS'].to_s.strip.split
|
|
116
|
+
args.push('--').concat(additional_options).push('--')
|
|
116
117
|
args.concat(Rake::FileList[pattern].to_a)
|
|
117
118
|
|
|
118
119
|
ParallelTests::CLI.new.run(args)
|
|
@@ -120,35 +121,6 @@ task :parallel_spec_standalone do |_t, args|
|
|
|
120
121
|
end
|
|
121
122
|
end
|
|
122
123
|
|
|
123
|
-
desc 'Build puppet module package'
|
|
124
|
-
task :build do
|
|
125
|
-
Rake::Task['build:pdk'].invoke
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
namespace :build do
|
|
129
|
-
desc 'Build Puppet module with PDK'
|
|
130
|
-
task :pdk do
|
|
131
|
-
require 'pdk/util'
|
|
132
|
-
require 'pdk/module/build'
|
|
133
|
-
|
|
134
|
-
path = PDK::Module::Build.invoke(force: true, 'target-dir': File.join(Dir.pwd, 'pkg'))
|
|
135
|
-
puts "Module built: #{path}"
|
|
136
|
-
rescue LoadError
|
|
137
|
-
_ = `pdk --version`
|
|
138
|
-
unless $CHILD_STATUS.success?
|
|
139
|
-
warn 'Unable to build module. Please install PDK or add the `pdk` gem to your Gemfile.'
|
|
140
|
-
abort
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
system('pdk build --force')
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
desc 'Clean a built module package'
|
|
148
|
-
task :clean do
|
|
149
|
-
FileUtils.rm_rf('pkg/')
|
|
150
|
-
end
|
|
151
|
-
|
|
152
124
|
require 'puppet-lint/tasks/puppet-lint'
|
|
153
125
|
# Must clear as it will not override the existing puppet-lint rake task since we require to import for
|
|
154
126
|
# the PuppetLint::RakeTask
|
|
@@ -169,14 +141,13 @@ puppet_lint_disable_checks = %w[
|
|
|
169
141
|
80chars
|
|
170
142
|
140chars
|
|
171
143
|
class_inherits_from_params_class
|
|
172
|
-
class_parameter_defaults
|
|
173
144
|
disable_autoloader_layout
|
|
174
145
|
documentation
|
|
175
146
|
single_quote_string_with_variables
|
|
176
147
|
]
|
|
177
148
|
|
|
178
149
|
puppet_lint_disable_checks.each do |check|
|
|
179
|
-
PuppetLint.configuration.send("disable_#{check}")
|
|
150
|
+
PuppetLint.configuration.send(:"disable_#{check}")
|
|
180
151
|
end
|
|
181
152
|
PuppetLint::RakeTask.new(:lint)
|
|
182
153
|
|
|
@@ -191,7 +162,8 @@ PuppetSyntax.exclude_paths << 'spec/fixtures/**/*'
|
|
|
191
162
|
PuppetSyntax.exclude_paths << 'pkg/**/*'
|
|
192
163
|
PuppetSyntax.exclude_paths << 'vendor/**/*'
|
|
193
164
|
PuppetSyntax.exclude_paths << '.vendor/**/*'
|
|
194
|
-
PuppetSyntax.
|
|
165
|
+
PuppetSyntax.check_hiera_keys = true
|
|
166
|
+
PuppetSyntax.check_hiera_data = true
|
|
195
167
|
|
|
196
168
|
desc 'Check syntax of Ruby files and call :syntax and :metadata_lint'
|
|
197
169
|
task :validate do
|
|
@@ -379,16 +351,16 @@ def create_gch_task(changelog_user = nil, changelog_project = nil, changelog_sin
|
|
|
379
351
|
config.configure_sections = {
|
|
380
352
|
'Changed' => {
|
|
381
353
|
'prefix' => '### Changed',
|
|
382
|
-
'labels' => ['backwards-incompatible']
|
|
354
|
+
'labels' => ['backwards-incompatible'],
|
|
383
355
|
},
|
|
384
356
|
'Added' => {
|
|
385
357
|
'prefix' => '### Added',
|
|
386
|
-
'labels' => %w[feature enhancement]
|
|
358
|
+
'labels' => %w[feature enhancement],
|
|
387
359
|
},
|
|
388
360
|
'Fixed' => {
|
|
389
361
|
'prefix' => '### Fixed',
|
|
390
|
-
'labels' => ['bugfix']
|
|
391
|
-
}
|
|
362
|
+
'labels' => ['bugfix'],
|
|
363
|
+
},
|
|
392
364
|
}
|
|
393
365
|
end
|
|
394
366
|
else
|
|
@@ -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']
|
|
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
|
|
@@ -318,7 +317,7 @@ module PuppetlabsSpecHelper
|
|
|
318
317
|
end
|
|
319
318
|
end
|
|
320
319
|
# wait for all the threads to finish
|
|
321
|
-
items.
|
|
320
|
+
items.each_value { |opts| opts[:thread].join }
|
|
322
321
|
end
|
|
323
322
|
|
|
324
323
|
# @param target [String] - the target directory
|
|
@@ -380,6 +379,9 @@ module PuppetlabsSpecHelper
|
|
|
380
379
|
flags = " #{opts['flags']}" if opts['flags']
|
|
381
380
|
end
|
|
382
381
|
|
|
382
|
+
forge_token = ENV.fetch('FORGE_API_KEY', nil)
|
|
383
|
+
flags += " --forge_authorization \"Bearer #{forge_token}\"" if forge_token
|
|
384
|
+
|
|
383
385
|
return false if File.directory?(target) && (ref.empty? || opts['ref'] == module_version(target))
|
|
384
386
|
|
|
385
387
|
# The PMT cannot handle multi threaded runs due to cache directory collisons
|
|
@@ -428,12 +430,12 @@ end
|
|
|
428
430
|
|
|
429
431
|
desc 'Clean up the fixtures directory'
|
|
430
432
|
task :spec_clean do
|
|
431
|
-
repositories.
|
|
433
|
+
repositories.each_value do |opts|
|
|
432
434
|
target = opts['target']
|
|
433
435
|
FileUtils.rm_rf(target)
|
|
434
436
|
end
|
|
435
437
|
|
|
436
|
-
forge_modules.
|
|
438
|
+
forge_modules.each_value do |opts|
|
|
437
439
|
target = opts['target']
|
|
438
440
|
FileUtils.rm_rf(target)
|
|
439
441
|
end
|
|
@@ -447,7 +449,7 @@ end
|
|
|
447
449
|
|
|
448
450
|
desc 'Clean up any fixture symlinks'
|
|
449
451
|
task :spec_clean_symlinks do
|
|
450
|
-
fixtures('symlinks').
|
|
452
|
+
fixtures('symlinks').each_value do |opts|
|
|
451
453
|
target = opts['target']
|
|
452
454
|
FileUtils.rm_f(target)
|
|
453
455
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
13
|
SimpleCov::Formatter::Console,
|
|
11
|
-
SimpleCov::Formatter::Codecov
|
|
12
14
|
]
|
|
15
|
+
|
|
13
16
|
SimpleCov.start do
|
|
14
17
|
track_files 'lib/**/*.rb'
|
|
15
18
|
|
|
@@ -31,7 +31,7 @@ describe 'rake check:symlinks', type: :task do
|
|
|
31
31
|
let(:test_files) do
|
|
32
32
|
[
|
|
33
33
|
File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
34
|
-
File.join(Dir.pwd, 'files', 'another_file.pp')
|
|
34
|
+
File.join(Dir.pwd, 'files', 'another_file.pp'),
|
|
35
35
|
]
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -43,13 +43,13 @@ describe 'rake check:symlinks', type: :task do
|
|
|
43
43
|
context 'when there is a symlink present' do
|
|
44
44
|
let(:test_files) do
|
|
45
45
|
[
|
|
46
|
-
File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
46
|
+
File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
47
47
|
]
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
let(:symlinks) do
|
|
51
51
|
{
|
|
52
|
-
File.join(Dir.pwd, 'files', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
52
|
+
File.join(Dir.pwd, 'files', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
53
53
|
}
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -63,13 +63,13 @@ describe 'rake check:symlinks', type: :task do
|
|
|
63
63
|
context 'when there are symlinks under .git/' do
|
|
64
64
|
let(:test_files) do
|
|
65
65
|
[
|
|
66
|
-
File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
66
|
+
File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
67
67
|
]
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
let(:symlinks) do
|
|
71
71
|
{
|
|
72
|
-
File.join(Dir.pwd, '.git', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
72
|
+
File.join(Dir.pwd, '.git', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
73
73
|
}
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -81,13 +81,13 @@ describe 'rake check:symlinks', type: :task do
|
|
|
81
81
|
context 'when there are symlinks under .bundle/' do
|
|
82
82
|
let(:test_files) do
|
|
83
83
|
[
|
|
84
|
-
File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
84
|
+
File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
85
85
|
]
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
let(:symlinks) do
|
|
89
89
|
{
|
|
90
|
-
File.join(Dir.pwd, '.bundle', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
90
|
+
File.join(Dir.pwd, '.bundle', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
91
91
|
}
|
|
92
92
|
end
|
|
93
93
|
|
|
@@ -99,13 +99,13 @@ describe 'rake check:symlinks', type: :task do
|
|
|
99
99
|
context 'when there are symlinks under vendor/' do
|
|
100
100
|
let(:test_files) do
|
|
101
101
|
[
|
|
102
|
-
File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
102
|
+
File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
103
103
|
]
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
let(:symlinks) do
|
|
107
107
|
{
|
|
108
|
-
File.join(Dir.pwd, 'vendor', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
108
|
+
File.join(Dir.pwd, 'vendor', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
109
109
|
}
|
|
110
110
|
end
|
|
111
111
|
|
|
@@ -121,13 +121,13 @@ describe 'rake check:symlinks', type: :task do
|
|
|
121
121
|
|
|
122
122
|
let(:test_files) do
|
|
123
123
|
[
|
|
124
|
-
File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
124
|
+
File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
125
125
|
]
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
let(:symlinks) do
|
|
129
129
|
{
|
|
130
|
-
File.join(Dir.pwd, 'a_directory', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
130
|
+
File.join(Dir.pwd, 'a_directory', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
131
131
|
}
|
|
132
132
|
end
|
|
133
133
|
|
|
@@ -145,13 +145,13 @@ describe 'rake check:symlinks', type: :task do
|
|
|
145
145
|
|
|
146
146
|
let(:test_files) do
|
|
147
147
|
[
|
|
148
|
-
File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
148
|
+
File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
149
149
|
]
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
let(:symlinks) do
|
|
153
153
|
{
|
|
154
|
-
File.join(Dir.pwd, 'another_directory', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
|
|
154
|
+
File.join(Dir.pwd, 'another_directory', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
|
|
155
155
|
}
|
|
156
156
|
end
|
|
157
157
|
|
|
@@ -14,7 +14,7 @@ describe 'rake check:test_file', type: :task do
|
|
|
14
14
|
let(:test_files) do
|
|
15
15
|
[
|
|
16
16
|
File.join(Dir.pwd, 'tests', 'an_example.pp'),
|
|
17
|
-
File.join(Dir.pwd, 'tests', 'deep', 'directory', 'structure', 'another_example.pp')
|
|
17
|
+
File.join(Dir.pwd, 'tests', 'deep', 'directory', 'structure', 'another_example.pp'),
|
|
18
18
|
]
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -141,7 +141,7 @@ describe PuppetlabsSpecHelper::Tasks::FixtureHelpers do
|
|
|
141
141
|
'branch' => nil,
|
|
142
142
|
'scm' => nil,
|
|
143
143
|
'flags' => nil,
|
|
144
|
-
'subdir' => nil
|
|
144
|
+
'subdir' => nil,
|
|
145
145
|
},
|
|
146
146
|
)
|
|
147
147
|
end
|
|
@@ -159,18 +159,41 @@ describe PuppetlabsSpecHelper::Tasks::FixtureHelpers do
|
|
|
159
159
|
'branch' => nil,
|
|
160
160
|
'scm' => nil,
|
|
161
161
|
'flags' => '--module_repository=https://myforge.example.com/',
|
|
162
|
-
'subdir' => nil
|
|
162
|
+
'subdir' => nil,
|
|
163
163
|
},
|
|
164
164
|
)
|
|
165
165
|
end
|
|
166
166
|
end
|
|
167
167
|
|
|
168
|
+
context 'when forge_api_key env variable is set' do
|
|
169
|
+
before do
|
|
170
|
+
# required to prevent unwanted output on stub of $CHILD_STATUS
|
|
171
|
+
RSpec::Mocks.configuration.allow_message_expectations_on_nil = true
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
after do
|
|
175
|
+
RSpec::Mocks.configuration.allow_message_expectations_on_nil = false
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
it 'correctly sets --forge_authorization' do
|
|
179
|
+
allow(ENV).to receive(:fetch).with('FORGE_API_KEY', nil).and_return('myforgeapikey')
|
|
180
|
+
# Mock the system call to prevent actual execution
|
|
181
|
+
allow_any_instance_of(Kernel).to receive(:system) do |command| # rubocop:disable RSpec/AnyInstance
|
|
182
|
+
expect(command).to include('--forge_authorization "Bearer myforgeapikey"')
|
|
183
|
+
# Simulate setting $CHILD_STATUS to a successful status
|
|
184
|
+
allow($CHILD_STATUS).to receive(:success?).and_return(true)
|
|
185
|
+
true
|
|
186
|
+
end
|
|
187
|
+
helper.download_module('puppetlabs-stdlib', 'target' => 'spec/fixtures/modules/stdlib')
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
168
191
|
context 'when file specifies repository fixtures' do
|
|
169
192
|
before do
|
|
170
193
|
allow(File).to receive(:exist?).with('.fixtures.yml').and_return true
|
|
171
194
|
allow(YAML).to receive(:load_file).with('.fixtures.yml').and_return(
|
|
172
195
|
'fixtures' => {
|
|
173
|
-
'repositories' => { 'stdlib' => 'https://github.com/puppetlabs/puppetlabs-stdlib.git' }
|
|
196
|
+
'repositories' => { 'stdlib' => 'https://github.com/puppetlabs/puppetlabs-stdlib.git' },
|
|
174
197
|
},
|
|
175
198
|
)
|
|
176
199
|
end
|
|
@@ -183,7 +206,7 @@ describe PuppetlabsSpecHelper::Tasks::FixtureHelpers do
|
|
|
183
206
|
'branch' => nil,
|
|
184
207
|
'scm' => nil,
|
|
185
208
|
'flags' => nil,
|
|
186
|
-
'subdir' => nil
|
|
209
|
+
'subdir' => nil,
|
|
187
210
|
},
|
|
188
211
|
)
|
|
189
212
|
end
|
|
@@ -198,9 +221,9 @@ describe PuppetlabsSpecHelper::Tasks::FixtureHelpers do
|
|
|
198
221
|
'stdlib' => {
|
|
199
222
|
'scm' => 'git',
|
|
200
223
|
'repo' => 'https://github.com/puppetlabs/puppetlabs-stdlib.git',
|
|
201
|
-
'ref' => 'this/is/a/branch'
|
|
202
|
-
}
|
|
203
|
-
}
|
|
224
|
+
'ref' => 'this/is/a/branch',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
204
227
|
},
|
|
205
228
|
)
|
|
206
229
|
end
|
|
@@ -222,9 +245,9 @@ describe PuppetlabsSpecHelper::Tasks::FixtureHelpers do
|
|
|
222
245
|
'forge_modules' => {
|
|
223
246
|
'stdlib' => {
|
|
224
247
|
'repo' => 'puppetlabs-stdlib',
|
|
225
|
-
'puppet_version' => Puppet::PUPPETVERSION
|
|
226
|
-
}
|
|
227
|
-
}
|
|
248
|
+
'puppet_version' => Puppet::PUPPETVERSION,
|
|
249
|
+
},
|
|
250
|
+
},
|
|
228
251
|
},
|
|
229
252
|
)
|
|
230
253
|
expect(helper.fixtures('forge_modules')).to include('puppetlabs-stdlib')
|
|
@@ -236,9 +259,9 @@ describe PuppetlabsSpecHelper::Tasks::FixtureHelpers do
|
|
|
236
259
|
'forge_modules' => {
|
|
237
260
|
'stdlib' => {
|
|
238
261
|
'repo' => 'puppetlabs-stdlib',
|
|
239
|
-
'puppet_version' => '>= 999.9.9'
|
|
240
|
-
}
|
|
241
|
-
}
|
|
262
|
+
'puppet_version' => '>= 999.9.9',
|
|
263
|
+
},
|
|
264
|
+
},
|
|
242
265
|
},
|
|
243
266
|
)
|
|
244
267
|
expect(helper.fixtures('forge_modules')).to eq({})
|
|
@@ -250,9 +273,9 @@ describe PuppetlabsSpecHelper::Tasks::FixtureHelpers do
|
|
|
250
273
|
'forge_modules' => {
|
|
251
274
|
'stdlib' => {
|
|
252
275
|
'repo' => 'puppetlabs-stdlib',
|
|
253
|
-
'puppet_version' => Puppet::PUPPETVERSION
|
|
254
|
-
}
|
|
255
|
-
}
|
|
276
|
+
'puppet_version' => Puppet::PUPPETVERSION,
|
|
277
|
+
},
|
|
278
|
+
},
|
|
256
279
|
},
|
|
257
280
|
)
|
|
258
281
|
expect(helper.fixtures('forge_modules')).to include('puppetlabs-stdlib')
|
data/spec/watchr.rb
CHANGED
|
@@ -11,7 +11,7 @@ def growl(message)
|
|
|
11
11
|
title = 'Watchr Test Results'
|
|
12
12
|
image = case message
|
|
13
13
|
when /(\d+)\s+?(failure|error)/i
|
|
14
|
-
Regexp.last_match(1).to_i == 0 ? '~/.watchr_images/passed.png' : '~/.watchr_images/failed.png'
|
|
14
|
+
(Regexp.last_match(1).to_i == 0) ? '~/.watchr_images/passed.png' : '~/.watchr_images/failed.png'
|
|
15
15
|
else
|
|
16
16
|
'~/.watchr_images/unknown.png'
|
|
17
17
|
end
|
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:
|
|
4
|
+
version: 8.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Puppet, Inc.
|
|
@@ -9,22 +9,28 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2024-09-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: mocha
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
|
-
- - "
|
|
18
|
+
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
20
|
version: '1.0'
|
|
21
|
+
- - "<"
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: '3'
|
|
21
24
|
type: :runtime
|
|
22
25
|
prerelease: false
|
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
27
|
requirements:
|
|
25
|
-
- - "
|
|
28
|
+
- - ">="
|
|
26
29
|
- !ruby/object:Gem::Version
|
|
27
30
|
version: '1.0'
|
|
31
|
+
- - "<"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3'
|
|
28
34
|
- !ruby/object:Gem::Dependency
|
|
29
35
|
name: pathspec
|
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -34,7 +40,7 @@ dependencies:
|
|
|
34
40
|
version: '0.2'
|
|
35
41
|
- - "<"
|
|
36
42
|
- !ruby/object:Gem::Version
|
|
37
|
-
version:
|
|
43
|
+
version: '3'
|
|
38
44
|
type: :runtime
|
|
39
45
|
prerelease: false
|
|
40
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -44,7 +50,7 @@ dependencies:
|
|
|
44
50
|
version: '0.2'
|
|
45
51
|
- - "<"
|
|
46
52
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
53
|
+
version: '3'
|
|
48
54
|
- !ruby/object:Gem::Dependency
|
|
49
55
|
name: puppet-lint
|
|
50
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -65,14 +71,20 @@ dependencies:
|
|
|
65
71
|
requirements:
|
|
66
72
|
- - "~>"
|
|
67
73
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
74
|
+
version: '4.1'
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: 4.1.1
|
|
69
78
|
type: :runtime
|
|
70
79
|
prerelease: false
|
|
71
80
|
version_requirements: !ruby/object:Gem::Requirement
|
|
72
81
|
requirements:
|
|
73
82
|
- - "~>"
|
|
74
83
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
84
|
+
version: '4.1'
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: 4.1.1
|
|
76
88
|
- !ruby/object:Gem::Dependency
|
|
77
89
|
name: rspec-github
|
|
78
90
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -93,14 +105,28 @@ dependencies:
|
|
|
93
105
|
requirements:
|
|
94
106
|
- - "~>"
|
|
95
107
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
108
|
+
version: '5.0'
|
|
97
109
|
type: :runtime
|
|
98
110
|
prerelease: false
|
|
99
111
|
version_requirements: !ruby/object:Gem::Requirement
|
|
100
112
|
requirements:
|
|
101
113
|
- - "~>"
|
|
102
114
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
115
|
+
version: '5.0'
|
|
116
|
+
- !ruby/object:Gem::Dependency
|
|
117
|
+
name: voxpupuli-rubocop
|
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
|
119
|
+
requirements:
|
|
120
|
+
- - "~>"
|
|
121
|
+
- !ruby/object:Gem::Version
|
|
122
|
+
version: 2.8.0
|
|
123
|
+
type: :development
|
|
124
|
+
prerelease: false
|
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
126
|
+
requirements:
|
|
127
|
+
- - "~>"
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: 2.8.0
|
|
104
130
|
description: Contains rake tasks and a standard spec_helper for running spec tests
|
|
105
131
|
on puppet modules.
|
|
106
132
|
email:
|