puppetlabs_spec_helper 2.15.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +15 -0
- data/.rubocop.yml +19 -6
- data/.rubocop_todo.yml +18 -18
- data/.travis.yml +8 -18
- data/CHANGELOG.md +71 -3
- data/Gemfile +9 -13
- data/HISTORY.md +1 -1
- data/README.md +6 -2
- data/Rakefile +1 -1
- data/lib/puppetlabs_spec_helper/module_spec_helper.rb +11 -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 +69 -94
- data/lib/puppetlabs_spec_helper/tasks/check_symlinks.rb +4 -1
- data/lib/puppetlabs_spec_helper/tasks/fixtures.rb +31 -15
- data/lib/puppetlabs_spec_helper/version.rb +3 -1
- data/puppet_spec_helper.rb +2 -0
- data/puppetlabs_spec_helper.gemspec +6 -5
- data/puppetlabs_spec_helper.rb +2 -0
- metadata +43 -52
- data/lib/puppetlabs_spec_helper/tasks/beaker.rb +0 -112
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
require 'open3'
|
3
5
|
require 'json'
|
@@ -25,10 +27,21 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
25
27
|
File.basename(Dir.pwd).split('-').last
|
26
28
|
end
|
27
29
|
|
30
|
+
def module_version(path)
|
31
|
+
metadata_path = File.join(path, 'metadata.json')
|
32
|
+
raise ArgumentError unless File.file?(metadata_path) && File.readable?(metadata_path)
|
33
|
+
|
34
|
+
metadata = JSON.parse(File.read(metadata_path))
|
35
|
+
metadata.fetch('version', nil) || '0.0.1'
|
36
|
+
rescue JSON::ParserError, ArgumentError
|
37
|
+
logger.warn "Failed to find module version at path #{path}"
|
38
|
+
'0.0.1'
|
39
|
+
end
|
40
|
+
|
28
41
|
# @return [Hash] - returns a hash of all the fixture repositories
|
29
42
|
# @example
|
30
43
|
# {"puppetlabs-stdlib"=>{"target"=>"https://gitlab.com/puppetlabs/puppet-stdlib.git",
|
31
|
-
# "ref"=>nil, "branch"=>"
|
44
|
+
# "ref"=>nil, "branch"=>"main", "scm"=>nil,
|
32
45
|
# }}
|
33
46
|
def repositories
|
34
47
|
@repositories ||= fixtures('repositories') || {}
|
@@ -50,7 +63,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
50
63
|
|
51
64
|
# @return [Hash] - returns a hash with the module name and the source directory
|
52
65
|
def auto_symlink
|
53
|
-
{ module_name =>
|
66
|
+
{ module_name => "\#{source_dir}" }
|
54
67
|
end
|
55
68
|
|
56
69
|
# @return [Boolean] - true if the os is a windows system
|
@@ -116,21 +129,22 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
116
129
|
end
|
117
130
|
# there should be a warning or something if it's not a hash...
|
118
131
|
next unless opts.instance_of?(Hash)
|
132
|
+
|
119
133
|
# merge our options into the defaults to get the
|
120
134
|
# final option list
|
121
135
|
opts = defaults.merge(opts)
|
122
136
|
|
123
137
|
next unless include_repo?(opts['puppet_version'])
|
124
138
|
|
125
|
-
real_target = eval(
|
126
|
-
real_source = eval(
|
139
|
+
real_target = eval("\"#{opts['target']}\"", binding, __FILE__, __LINE__) # evaluating target reference in this context (see auto_symlink)
|
140
|
+
real_source = eval("\"#{opts['repo']}\"", binding, __FILE__, __LINE__) # evaluating repo reference in this context (see auto_symlink)
|
127
141
|
|
128
142
|
result[real_source] = validate_fixture_hash!(
|
129
143
|
'target' => File.join(real_target, fixture),
|
130
|
-
'ref'
|
144
|
+
'ref' => opts['ref'] || opts['tag'],
|
131
145
|
'branch' => opts['branch'],
|
132
|
-
'scm'
|
133
|
-
'flags'
|
146
|
+
'scm' => opts['scm'],
|
147
|
+
'flags' => opts['flags'],
|
134
148
|
'subdir' => opts['subdir'],
|
135
149
|
)
|
136
150
|
end
|
@@ -143,7 +157,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
143
157
|
return hash unless hash['scm'] == 'git'
|
144
158
|
|
145
159
|
# Forward slashes in the ref aren't allowed. And is probably a branch name.
|
146
|
-
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'] =~ %r{
|
160
|
+
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'] =~ %r{/}
|
147
161
|
|
148
162
|
hash
|
149
163
|
end
|
@@ -181,6 +195,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
181
195
|
unless File.exist?(target)
|
182
196
|
raise "Failed to clone #{scm} repository #{remote} into #{target}"
|
183
197
|
end
|
198
|
+
|
184
199
|
result
|
185
200
|
end
|
186
201
|
|
@@ -228,7 +243,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
228
243
|
end
|
229
244
|
|
230
245
|
def git_remote_url(target)
|
231
|
-
output, status = Open3.capture2e('git', '-
|
246
|
+
output, status = Open3.capture2e('git', '--git-dir', File.join(target, '.git'), 'ls-remote', '--get-url', 'origin')
|
232
247
|
status.success? ? output.strip : nil
|
233
248
|
end
|
234
249
|
|
@@ -251,7 +266,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
251
266
|
else
|
252
267
|
Logger::INFO
|
253
268
|
end
|
254
|
-
@logger = Logger.new(
|
269
|
+
@logger = Logger.new($stderr)
|
255
270
|
@logger.level = level
|
256
271
|
end
|
257
272
|
@logger
|
@@ -261,7 +276,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
261
276
|
# The problem with the relative path is that PMT doesn't expand the path properly and so passing in a relative path here
|
262
277
|
# becomes something like C:\somewhere\backslashes/spec/fixtures/work-dir on Windows, and then PMT barfs itself.
|
263
278
|
# This has been reported as https://tickets.puppetlabs.com/browse/PUP-4884
|
264
|
-
File.expand_path(
|
279
|
+
File.expand_path(ENV['MODULE_WORKING_DIR'] || 'spec/fixtures/work-dir')
|
265
280
|
end
|
266
281
|
|
267
282
|
# returns the current thread count that is currently active
|
@@ -318,6 +333,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
318
333
|
def setup_symlink(target, link)
|
319
334
|
link = link['target']
|
320
335
|
return if File.symlink?(link)
|
336
|
+
|
321
337
|
logger.info("Creating symlink from #{link} to #{target}")
|
322
338
|
if windows?
|
323
339
|
target = File.join(File.dirname(link), target) unless Pathname.new(target).absolute?
|
@@ -370,13 +386,13 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
370
386
|
flags = " #{opts['flags']}" if opts['flags']
|
371
387
|
end
|
372
388
|
|
373
|
-
return false if File.directory?(target)
|
389
|
+
return false if File.directory?(target) && (ref.empty? || opts['ref'] == module_version(target))
|
374
390
|
|
375
391
|
# The PMT cannot handle multi threaded runs due to cache directory collisons
|
376
392
|
# so we randomize the directory instead.
|
377
393
|
# Does working_dir even need to be passed?
|
378
394
|
Dir.mktmpdir do |working_dir|
|
379
|
-
command =
|
395
|
+
command = "puppet module install#{ref}#{flags} --ignore-dependencies" \
|
380
396
|
' --force' \
|
381
397
|
" --module_working_dir \"#{working_dir}\"" \
|
382
398
|
" --target-dir \"#{module_target_dir}\" \"#{remote}\""
|
@@ -389,7 +405,7 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
|
389
405
|
end
|
390
406
|
end
|
391
407
|
|
392
|
-
include PuppetlabsSpecHelper::Tasks::FixtureHelpers
|
408
|
+
include PuppetlabsSpecHelper::Tasks::FixtureHelpers # DSL include # rubocop:disable Style/MixinUsage
|
393
409
|
|
394
410
|
desc 'Create the fixtures directory'
|
395
411
|
task :spec_prep do
|
@@ -399,7 +415,7 @@ task :spec_prep do
|
|
399
415
|
begin
|
400
416
|
require 'win32/dir'
|
401
417
|
rescue LoadError
|
402
|
-
|
418
|
+
warn 'win32-dir gem not installed, falling back to executing mklink directly'
|
403
419
|
end
|
404
420
|
end
|
405
421
|
|
data/puppet_spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'puppetlabs_spec_helper/version'
|
6
6
|
|
@@ -20,18 +20,19 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.4')
|
24
|
+
|
23
25
|
spec.add_runtime_dependency 'mocha', '~> 1.0'
|
26
|
+
spec.add_runtime_dependency 'pathspec', '>= 0.2.1', '< 1.1.0'
|
24
27
|
spec.add_runtime_dependency 'puppet-lint', '~> 2.0'
|
25
28
|
spec.add_runtime_dependency 'puppet-syntax', ['>= 2.0', '< 4']
|
26
29
|
spec.add_runtime_dependency 'rspec-puppet', '~> 2.0'
|
27
|
-
spec.add_runtime_dependency 'pathspec', '~> 0.2.1'
|
28
30
|
|
29
31
|
spec.add_development_dependency 'bundler'
|
32
|
+
spec.add_development_dependency 'fakefs', ['>= 0.13.3', '< 2']
|
30
33
|
spec.add_development_dependency 'pry'
|
31
34
|
spec.add_development_dependency 'puppet'
|
32
35
|
spec.add_development_dependency 'rake', ['>= 10.0', '< 14']
|
33
36
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
37
|
spec.add_development_dependency 'yard'
|
35
|
-
spec.add_development_dependency 'gettext-setup', '~> 0.29'
|
36
|
-
spec.add_development_dependency 'fakefs', ['>= 0.13.3', '< 2']
|
37
38
|
end
|
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.1
|
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-08-23 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
|
@@ -74,33 +94,39 @@ dependencies:
|
|
74
94
|
- !ruby/object:Gem::Version
|
75
95
|
version: '2.0'
|
76
96
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
97
|
+
name: bundler
|
78
98
|
requirement: !ruby/object:Gem::Requirement
|
79
99
|
requirements:
|
80
|
-
- - "
|
100
|
+
- - ">="
|
81
101
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0
|
83
|
-
type: :
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
84
104
|
prerelease: false
|
85
105
|
version_requirements: !ruby/object:Gem::Requirement
|
86
106
|
requirements:
|
87
|
-
- - "
|
107
|
+
- - ">="
|
88
108
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
109
|
+
version: '0'
|
90
110
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
111
|
+
name: fakefs
|
92
112
|
requirement: !ruby/object:Gem::Requirement
|
93
113
|
requirements:
|
94
114
|
- - ">="
|
95
115
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
116
|
+
version: 0.13.3
|
117
|
+
- - "<"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '2'
|
97
120
|
type: :development
|
98
121
|
prerelease: false
|
99
122
|
version_requirements: !ruby/object:Gem::Requirement
|
100
123
|
requirements:
|
101
124
|
- - ">="
|
102
125
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
126
|
+
version: 0.13.3
|
127
|
+
- - "<"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '2'
|
104
130
|
- !ruby/object:Gem::Dependency
|
105
131
|
name: pry
|
106
132
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,40 +203,6 @@ dependencies:
|
|
177
203
|
- - ">="
|
178
204
|
- !ruby/object:Gem::Version
|
179
205
|
version: '0'
|
180
|
-
- !ruby/object:Gem::Dependency
|
181
|
-
name: gettext-setup
|
182
|
-
requirement: !ruby/object:Gem::Requirement
|
183
|
-
requirements:
|
184
|
-
- - "~>"
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: '0.29'
|
187
|
-
type: :development
|
188
|
-
prerelease: false
|
189
|
-
version_requirements: !ruby/object:Gem::Requirement
|
190
|
-
requirements:
|
191
|
-
- - "~>"
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
version: '0.29'
|
194
|
-
- !ruby/object:Gem::Dependency
|
195
|
-
name: fakefs
|
196
|
-
requirement: !ruby/object:Gem::Requirement
|
197
|
-
requirements:
|
198
|
-
- - ">="
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: 0.13.3
|
201
|
-
- - "<"
|
202
|
-
- !ruby/object:Gem::Version
|
203
|
-
version: '2'
|
204
|
-
type: :development
|
205
|
-
prerelease: false
|
206
|
-
version_requirements: !ruby/object:Gem::Requirement
|
207
|
-
requirements:
|
208
|
-
- - ">="
|
209
|
-
- !ruby/object:Gem::Version
|
210
|
-
version: 0.13.3
|
211
|
-
- - "<"
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
version: '2'
|
214
206
|
description: Contains rake tasks and a standard spec_helper for running spec tests
|
215
207
|
on puppet modules.
|
216
208
|
email:
|
@@ -219,6 +211,7 @@ executables: []
|
|
219
211
|
extensions: []
|
220
212
|
extra_rdoc_files: []
|
221
213
|
files:
|
214
|
+
- ".github/dependabot.yml"
|
222
215
|
- ".gitignore"
|
223
216
|
- ".noexec.yaml"
|
224
217
|
- ".rspec"
|
@@ -241,7 +234,6 @@ files:
|
|
241
234
|
- lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb
|
242
235
|
- lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb
|
243
236
|
- lib/puppetlabs_spec_helper/rake_tasks.rb
|
244
|
-
- lib/puppetlabs_spec_helper/tasks/beaker.rb
|
245
237
|
- lib/puppetlabs_spec_helper/tasks/check_symlinks.rb
|
246
238
|
- lib/puppetlabs_spec_helper/tasks/fixtures.rb
|
247
239
|
- lib/puppetlabs_spec_helper/version.rb
|
@@ -252,7 +244,7 @@ homepage: http://github.com/puppetlabs/puppetlabs_spec_helper
|
|
252
244
|
licenses:
|
253
245
|
- Apache-2.0
|
254
246
|
metadata: {}
|
255
|
-
post_install_message:
|
247
|
+
post_install_message:
|
256
248
|
rdoc_options: []
|
257
249
|
require_paths:
|
258
250
|
- lib
|
@@ -260,16 +252,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
260
252
|
requirements:
|
261
253
|
- - ">="
|
262
254
|
- !ruby/object:Gem::Version
|
263
|
-
version: '
|
255
|
+
version: '2.4'
|
264
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
257
|
requirements:
|
266
258
|
- - ">="
|
267
259
|
- !ruby/object:Gem::Version
|
268
260
|
version: '0'
|
269
261
|
requirements: []
|
270
|
-
|
271
|
-
|
272
|
-
signing_key:
|
262
|
+
rubygems_version: 3.1.6
|
263
|
+
signing_key:
|
273
264
|
specification_version: 4
|
274
265
|
summary: Standard tasks and configuration for module spec tests.
|
275
266
|
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
|