puppetlabs_spec_helper 2.14.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +15 -0
- data/.rubocop.yml +23 -6
- data/.rubocop_todo.yml +18 -18
- data/.travis.yml +14 -26
- data/CHANGELOG.md +87 -2
- data/CODEOWNERS +2 -0
- data/Gemfile +28 -10
- data/HISTORY.md +1 -1
- data/README.md +11 -34
- data/Rakefile +1 -1
- data/lib/puppetlabs_spec_helper/module_spec_helper.rb +10 -0
- data/lib/puppetlabs_spec_helper/puppet_spec_helper.rb +4 -2
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb +2 -0
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/fixtures.rb +7 -2
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb +4 -2
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb +5 -2
- data/lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb +2 -0
- data/lib/puppetlabs_spec_helper/rake_tasks.rb +131 -78
- data/lib/puppetlabs_spec_helper/tasks/check_symlinks.rb +4 -1
- data/lib/puppetlabs_spec_helper/tasks/fixtures.rb +161 -91
- data/lib/puppetlabs_spec_helper/version.rb +3 -1
- data/puppet_spec_helper.rb +2 -0
- data/puppetlabs_spec_helper.gemspec +8 -7
- data/puppetlabs_spec_helper.rb +2 -0
- metadata +61 -50
- data/lib/puppetlabs_spec_helper/tasks/beaker.rb +0 -112
data/puppetlabs_spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppetlabs_spec_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
8
|
- Community Contributors
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mocha
|
@@ -25,6 +25,26 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: pathspec
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.2.1
|
35
|
+
- - "<"
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.1.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.2.1
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.1.0
|
28
48
|
- !ruby/object:Gem::Dependency
|
29
49
|
name: puppet-lint
|
30
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,16 +63,22 @@ dependencies:
|
|
43
63
|
name: puppet-syntax
|
44
64
|
requirement: !ruby/object:Gem::Requirement
|
45
65
|
requirements:
|
46
|
-
- - "
|
66
|
+
- - ">="
|
47
67
|
- !ruby/object:Gem::Version
|
48
68
|
version: '2.0'
|
69
|
+
- - "<"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '4'
|
49
72
|
type: :runtime
|
50
73
|
prerelease: false
|
51
74
|
version_requirements: !ruby/object:Gem::Requirement
|
52
75
|
requirements:
|
53
|
-
- - "
|
76
|
+
- - ">="
|
54
77
|
- !ruby/object:Gem::Version
|
55
78
|
version: '2.0'
|
79
|
+
- - "<"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '4'
|
56
82
|
- !ruby/object:Gem::Dependency
|
57
83
|
name: rspec-puppet
|
58
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,33 +94,39 @@ dependencies:
|
|
68
94
|
- !ruby/object:Gem::Version
|
69
95
|
version: '2.0'
|
70
96
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
97
|
+
name: bundler
|
72
98
|
requirement: !ruby/object:Gem::Requirement
|
73
99
|
requirements:
|
74
|
-
- - "
|
100
|
+
- - ">="
|
75
101
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0
|
77
|
-
type: :
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
78
104
|
prerelease: false
|
79
105
|
version_requirements: !ruby/object:Gem::Requirement
|
80
106
|
requirements:
|
81
|
-
- - "
|
107
|
+
- - ">="
|
82
108
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0
|
109
|
+
version: '0'
|
84
110
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
111
|
+
name: fakefs
|
86
112
|
requirement: !ruby/object:Gem::Requirement
|
87
113
|
requirements:
|
88
114
|
- - ">="
|
89
115
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
116
|
+
version: 0.13.3
|
117
|
+
- - "<"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '2'
|
91
120
|
type: :development
|
92
121
|
prerelease: false
|
93
122
|
version_requirements: !ruby/object:Gem::Requirement
|
94
123
|
requirements:
|
95
124
|
- - ">="
|
96
125
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
126
|
+
version: 0.13.3
|
127
|
+
- - "<"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '2'
|
98
130
|
- !ruby/object:Gem::Dependency
|
99
131
|
name: pry
|
100
132
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,16 +159,22 @@ dependencies:
|
|
127
159
|
name: rake
|
128
160
|
requirement: !ruby/object:Gem::Requirement
|
129
161
|
requirements:
|
130
|
-
- - "
|
162
|
+
- - ">="
|
131
163
|
- !ruby/object:Gem::Version
|
132
164
|
version: '10.0'
|
165
|
+
- - "<"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '14'
|
133
168
|
type: :development
|
134
169
|
prerelease: false
|
135
170
|
version_requirements: !ruby/object:Gem::Requirement
|
136
171
|
requirements:
|
137
|
-
- - "
|
172
|
+
- - ">="
|
138
173
|
- !ruby/object:Gem::Version
|
139
174
|
version: '10.0'
|
175
|
+
- - "<"
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '14'
|
140
178
|
- !ruby/object:Gem::Dependency
|
141
179
|
name: rspec
|
142
180
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,34 +203,6 @@ dependencies:
|
|
165
203
|
- - ">="
|
166
204
|
- !ruby/object:Gem::Version
|
167
205
|
version: '0'
|
168
|
-
- !ruby/object:Gem::Dependency
|
169
|
-
name: gettext-setup
|
170
|
-
requirement: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - "~>"
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '0.29'
|
175
|
-
type: :development
|
176
|
-
prerelease: false
|
177
|
-
version_requirements: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - "~>"
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0.29'
|
182
|
-
- !ruby/object:Gem::Dependency
|
183
|
-
name: fakefs
|
184
|
-
requirement: !ruby/object:Gem::Requirement
|
185
|
-
requirements:
|
186
|
-
- - "~>"
|
187
|
-
- !ruby/object:Gem::Version
|
188
|
-
version: 0.13.3
|
189
|
-
type: :development
|
190
|
-
prerelease: false
|
191
|
-
version_requirements: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - "~>"
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: 0.13.3
|
196
206
|
description: Contains rake tasks and a standard spec_helper for running spec tests
|
197
207
|
on puppet modules.
|
198
208
|
email:
|
@@ -201,6 +211,7 @@ executables: []
|
|
201
211
|
extensions: []
|
202
212
|
extra_rdoc_files: []
|
203
213
|
files:
|
214
|
+
- ".github/dependabot.yml"
|
204
215
|
- ".gitignore"
|
205
216
|
- ".noexec.yaml"
|
206
217
|
- ".rspec"
|
@@ -208,6 +219,7 @@ files:
|
|
208
219
|
- ".rubocop_todo.yml"
|
209
220
|
- ".travis.yml"
|
210
221
|
- CHANGELOG.md
|
222
|
+
- CODEOWNERS
|
211
223
|
- CONTRIBUTING.md
|
212
224
|
- Gemfile
|
213
225
|
- HISTORY.md
|
@@ -222,7 +234,6 @@ files:
|
|
222
234
|
- lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb
|
223
235
|
- lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb
|
224
236
|
- lib/puppetlabs_spec_helper/rake_tasks.rb
|
225
|
-
- lib/puppetlabs_spec_helper/tasks/beaker.rb
|
226
237
|
- lib/puppetlabs_spec_helper/tasks/check_symlinks.rb
|
227
238
|
- lib/puppetlabs_spec_helper/tasks/fixtures.rb
|
228
239
|
- lib/puppetlabs_spec_helper/version.rb
|
@@ -233,7 +244,7 @@ homepage: http://github.com/puppetlabs/puppetlabs_spec_helper
|
|
233
244
|
licenses:
|
234
245
|
- Apache-2.0
|
235
246
|
metadata: {}
|
236
|
-
post_install_message:
|
247
|
+
post_install_message:
|
237
248
|
rdoc_options: []
|
238
249
|
require_paths:
|
239
250
|
- lib
|
@@ -241,16 +252,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
241
252
|
requirements:
|
242
253
|
- - ">="
|
243
254
|
- !ruby/object:Gem::Version
|
244
|
-
version: '
|
255
|
+
version: '2.4'
|
245
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
257
|
requirements:
|
247
258
|
- - ">="
|
248
259
|
- !ruby/object:Gem::Version
|
249
260
|
version: '0'
|
250
261
|
requirements: []
|
251
|
-
rubyforge_project:
|
252
|
-
rubygems_version: 2.6.
|
253
|
-
signing_key:
|
262
|
+
rubyforge_project:
|
263
|
+
rubygems_version: 2.7.6.2
|
264
|
+
signing_key:
|
254
265
|
specification_version: 4
|
255
266
|
summary: Standard tasks and configuration for module spec tests.
|
256
267
|
test_files: []
|
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'rspec/core/rake_task'
|
2
|
-
|
3
|
-
module PuppetlabsSpecHelper; end
|
4
|
-
module PuppetlabsSpecHelper::Tasks; end
|
5
|
-
module PuppetlabsSpecHelper::Tasks::BeakerHelpers
|
6
|
-
# This is a helper for the self-symlink entry of fixtures.yml
|
7
|
-
def source_dir
|
8
|
-
Dir.pwd
|
9
|
-
end
|
10
|
-
|
11
|
-
# cache the repositories and return a hash object
|
12
|
-
def repositories
|
13
|
-
unless @repositories
|
14
|
-
@repositories = fixtures('repositories')
|
15
|
-
end
|
16
|
-
@repositories
|
17
|
-
end
|
18
|
-
|
19
|
-
# get the array of Beaker set names
|
20
|
-
# @return [Array<String>]
|
21
|
-
def beaker_node_sets
|
22
|
-
return @beaker_nodes if @beaker_nodes
|
23
|
-
@beaker_nodes = Dir['spec/acceptance/nodesets/*.yml'].sort.map do |node_set|
|
24
|
-
node_set.slice!('.yml')
|
25
|
-
File.basename(node_set)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Use "vagrant ssh" to login to the given node in the node set
|
30
|
-
# @param set [String] The name of the node set (yml file)
|
31
|
-
# @param node [String] The name of the node in the set. For multi-node sets.
|
32
|
-
def vagrant_ssh(set, node = nil)
|
33
|
-
vagrant_yml_dir = File.join '.vagrant', 'beaker_vagrant_files', "#{set}.yml"
|
34
|
-
vagrant_file = File.join vagrant_yml_dir, 'Vagrantfile'
|
35
|
-
unless File.file? vagrant_file
|
36
|
-
puts "There is no Vagrantfile at: '#{vagrant_file}'. Perhaps, the node is not created or is destroyed."
|
37
|
-
exit 1
|
38
|
-
end
|
39
|
-
Dir.chdir(vagrant_yml_dir) do
|
40
|
-
command = 'vagrant ssh'
|
41
|
-
command += " #{node}" if node
|
42
|
-
# Vagrant is not distributed as a normal gem
|
43
|
-
# and we should protect it from the current Ruby environment
|
44
|
-
env = {
|
45
|
-
'RUBYLIB' => nil,
|
46
|
-
'GEM_PATH' => nil,
|
47
|
-
'BUNDLE_BIN_PATH' => nil,
|
48
|
-
}
|
49
|
-
system env, command
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
include PuppetlabsSpecHelper::Tasks::BeakerHelpers
|
54
|
-
|
55
|
-
desc 'Run beaker acceptance tests'
|
56
|
-
RSpec::Core::RakeTask.new(:beaker) do |t|
|
57
|
-
SetupBeaker.setup_beaker(t)
|
58
|
-
end
|
59
|
-
|
60
|
-
class SetupBeaker
|
61
|
-
def self.setup_beaker(t)
|
62
|
-
t.rspec_opts = []
|
63
|
-
t.pattern = 'spec/acceptance'
|
64
|
-
# TEST_TIERS env variable is a comma separated list of tiers to run. e.g. low, medium, high
|
65
|
-
if ENV['TEST_TIERS']
|
66
|
-
test_tiers = ENV['TEST_TIERS'].split(',')
|
67
|
-
test_tiers_allowed = ENV.fetch('TEST_TIERS_ALLOWED', 'low,medium,high').split(',')
|
68
|
-
raise 'TEST_TIERS env variable must have at least 1 tier specified. Either low, medium or high or one of the tiers listed in TEST_TIERS_ALLOWED (comma separated).' if test_tiers.count == 0
|
69
|
-
test_tiers.each do |tier|
|
70
|
-
tier_to_add = tier.strip.downcase
|
71
|
-
raise "#{tier_to_add} not a valid test tier." unless test_tiers_allowed.include?(tier_to_add)
|
72
|
-
tiers = "--tag tier_#{tier_to_add}"
|
73
|
-
t.rspec_opts.push(tiers)
|
74
|
-
end
|
75
|
-
else
|
76
|
-
puts 'TEST_TIERS env variable not defined. Defaulting to run all tests.'
|
77
|
-
end
|
78
|
-
t
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
desc 'List available beaker nodesets'
|
83
|
-
task 'beaker:sets' do
|
84
|
-
beaker_node_sets.each do |set|
|
85
|
-
puts set
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
# alias for compatibility
|
90
|
-
task 'beaker_nodes' => 'beaker:sets'
|
91
|
-
|
92
|
-
desc 'Try to use vagrant to login to the Beaker node'
|
93
|
-
task 'beaker:ssh', [:set, :node] do |_task, args|
|
94
|
-
set = args[:set] || ENV['BEAKER_set'] || ENV['RS_SET'] || 'default'
|
95
|
-
node = args[:node]
|
96
|
-
vagrant_ssh set, node
|
97
|
-
end
|
98
|
-
|
99
|
-
beaker_node_sets.each do |set|
|
100
|
-
desc "Run the Beaker acceptance tests for the node set '#{set}'"
|
101
|
-
task "beaker:#{set}" do
|
102
|
-
ENV['BEAKER_set'] = set
|
103
|
-
Rake::Task['beaker'].reenable
|
104
|
-
Rake::Task['beaker'].invoke
|
105
|
-
end
|
106
|
-
|
107
|
-
desc "Use vagrant to login to a node from the set '#{set}'"
|
108
|
-
task "beaker:ssh:#{set}", [:node] do |_task, args|
|
109
|
-
node = args[:node]
|
110
|
-
vagrant_ssh set, node
|
111
|
-
end
|
112
|
-
end
|