puppetlabs_spec_helper 2.3.2 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f488df4c706569eee6e7f47135359abbb222391b
4
- data.tar.gz: bcc3ef4e868d31908422dec50ff9ab0bc7857269
3
+ metadata.gz: e45684c9216162f69c0dd3afd5d8dff52c4cd5b7
4
+ data.tar.gz: 2f37f0da9a4cac0d58df5612dc966a1f6a112c2d
5
5
  SHA512:
6
- metadata.gz: c2622f2e64e0eab60e978d9dcf4087dc58cb4236dd091327744358c6253cf2a4ae94691b70bcf4beb2b7f84639659a4e861a77f1e29326a5b8ed2891bdbd77b2
7
- data.tar.gz: 56c5b8c957e30886a3bd3b672d0a46e4ab5d0f71071282ef4da04c79e36087d85d575f2bee2150b0e6c217c5d958cc070b4b66e61d8519072c112e65450945f1
6
+ metadata.gz: de629171b63520b5245ac177521fe9f7cd37298d30957a1c9740916f74f572f8c18e15724471ea5bd63d6b4117dc31d059b9118ca00d7551dc98b1203410a49b
7
+ data.tar.gz: 34db93d7c4df67c8011672c04e76290f68aa20d1fd1eff673f83a8215fb66da534b345d95ecc3d4c6fdf352f669e4c491b8def5a1b14dbc21bd5d7526537d3e6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [2.4.0]
6
+ ### Summary
7
+ Fix mercurial stuff, allow fixtures other than spec/fixtures/modules/, and allow running specific tags for beaker tests.
8
+
9
+ ### Added
10
+ - Ability to check out branches in mercurial
11
+ - Ability to target alternative locations to clone fixtures
12
+ - `TEST_TIERS` environment variable for beaker rake task
13
+
14
+ ### Fixed
15
+ - mercurial cleanup command
16
+ - handle parallel spec load failure better
17
+
5
18
  ## [2.3.2]
6
19
  ### Summary
7
20
  Cleanups and fixes around fixture handling.
@@ -385,7 +398,8 @@ compatible yet.
385
398
  ### Added
386
399
  * Initial release
387
400
 
388
- [unreleased]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.3.2...master
401
+ [unreleased]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.4.0...master
402
+ [2.4.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.3.2...v2.4.0
389
403
  [2.3.2]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.3.1...v2.3.2
390
404
  [2.3.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.3.0...v2.3.1
391
405
  [2.3.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.2.0...v2.3.0
data/README.md CHANGED
@@ -240,6 +240,18 @@ fixtures:
240
240
  stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib"
241
241
  ```
242
242
 
243
+ Put a supplementary repository at a different location
244
+
245
+ ```yaml
246
+ fixtures:
247
+ repositories:
248
+ firewall: "git://github.com/puppetlabs/puppetlabs-firewall"
249
+ stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib"
250
+ control_repo:
251
+ repo: "https://github.com/puppetlabs/control-repo"
252
+ target: "spec/fixtures/control_repos"
253
+ ```
254
+
243
255
  Specify that the git tag `2.4.2` of `stdlib' should be checked out:
244
256
 
245
257
  ```yaml
@@ -333,6 +345,16 @@ remembering to duplicate any existing environment variables:
333
345
  env:
334
346
  - FUTURE_PARSER=yes CI_NODE_TOTAL=2 CI_NODE_INDEX=1
335
347
  - FUTURE_PARSER=yes CI_NODE_TOTAL=2 CI_NODE_INDEX=2
348
+
349
+ #### Running tests tagged with test tiers
350
+ To run tests tagged with risk levels set the ``TEST_TIERS`` environment variable to a comma-separated list of
351
+ the appropriate tiers.
352
+
353
+ For example: to run tests marked ``tier_high => true`` and ``tier_medium => true`` in the same test run set the
354
+ environment variable``TEST_TIERS=high,medium``
355
+
356
+ Note, if the ``TEST_TIERS`` environment variable is set to empty string or nil, all tiers will be executed.
357
+
336
358
 
337
359
  Generating code coverage reports
338
360
  ================================
@@ -12,6 +12,15 @@ rescue LoadError
12
12
  # ignore
13
13
  end
14
14
 
15
+ parallel_tests_loaded = false
16
+ begin
17
+ require 'parallel_tests'
18
+ parallel_tests_loaded = true
19
+ rescue LoadError
20
+ # ignore
21
+ end
22
+
23
+
15
24
  task :default => [:help]
16
25
 
17
26
  pattern = 'spec/{aliases,classes,defines,unit,functions,hosts,integration,type_aliases,types}/**/*_spec.rb'
@@ -46,6 +55,20 @@ desc "Run beaker acceptance tests"
46
55
  RSpec::Core::RakeTask.new(:beaker) do |t|
47
56
  t.rspec_opts = ['--color']
48
57
  t.pattern = 'spec/acceptance'
58
+ # TEST_TIERS env variable is a comma separated list of tiers to run. e.g. low, medium, high
59
+ if ENV['TEST_TIERS']
60
+ tiers = '--tag '
61
+ test_tiers = ENV['TEST_TIERS'].split(',')
62
+ raise 'TEST_TIERS env variable must have at least 1 tier specified. low, medium or high (comma separated).' if test_tiers.count == 0
63
+ test_tiers.each do |tier|
64
+ raise "#{tier} not a valid test tier." unless %w(low medium high).include?(tier)
65
+ tiers += "tier_#{tier},"
66
+ end
67
+ tiers = tiers.chomp(',')
68
+ t.rspec_opts.push(tiers)
69
+ else
70
+ puts 'TEST_TIERS env variable not defined. Defaulting to run all tests.'
71
+ end
49
72
  end
50
73
 
51
74
  # This is a helper for the self-symlink entry of fixtures.yml
@@ -134,9 +157,18 @@ def fixtures(category)
134
157
  real_source = eval('"'+source+'"')
135
158
  result[real_source] = target
136
159
  elsif opts.instance_of?(Hash)
137
- target = "spec/fixtures/modules/#{fixture}"
160
+
161
+ if opts["target"]
162
+ real_target = eval('"'+opts["target"]+'"')
163
+ end
164
+
165
+ unless real_target
166
+ real_target = "spec/fixtures/modules"
167
+ end
168
+
138
169
  real_source = eval('"'+opts["repo"]+'"')
139
- result[real_source] = { "target" => target, "ref" => opts["ref"], "branch" => opts["branch"], "scm" => opts["scm"], "flags" => opts["flags"], "subdir" => opts["subdir"]}
170
+
171
+ result[real_source] = { "target" => File.join(real_target,fixture), "ref" => opts["ref"], "branch" => opts["branch"], "scm" => opts["scm"], "flags" => opts["flags"], "subdir" => opts["subdir"]}
140
172
  end
141
173
  end
142
174
  end
@@ -148,7 +180,7 @@ def clone_repo(scm, remote, target, subdir=nil, ref=nil, branch=nil, flags = nil
148
180
  case scm
149
181
  when 'hg'
150
182
  args.push('clone')
151
- args.push('-u', ref) if ref
183
+ args.push('-b', branch) if branch
152
184
  args.push(flags) if flags
153
185
  args.push(remote, target)
154
186
  when 'git'
@@ -171,7 +203,7 @@ def revision(scm, target, ref)
171
203
  args = []
172
204
  case scm
173
205
  when 'hg'
174
- args.push('update', 'clean', '-r', ref)
206
+ args.push('update', '--clean', '-r', ref)
175
207
  when 'git'
176
208
  args.push('reset', '--hard', ref)
177
209
  else
@@ -379,17 +411,14 @@ end
379
411
 
380
412
  desc "Parallel spec tests"
381
413
  task :parallel_spec do
414
+ raise 'Add the parallel_tests gem to Gemfile to enable this task' unless parallel_tests_loaded
382
415
  begin
383
- require 'parallel_tests'
384
-
385
416
  args = ['-t', 'rspec']
386
417
  args.push('--').concat(ENV['CI_SPEC_OPTIONS'].strip.split(' ')).push('--') unless ENV['CI_SPEC_OPTIONS'].nil? || ENV['CI_SPEC_OPTIONS'].strip.empty?
387
418
  args.concat(Rake::FileList[pattern].to_a)
388
419
 
389
420
  Rake::Task[:spec_prep].invoke
390
421
  ParallelTests::CLI.new.run(args)
391
- rescue LoadError
392
- raise 'Add the parallel_tests gem to Gemfile to enable this task'
393
422
  ensure
394
423
  Rake::Task[:spec_clean].invoke
395
424
  end
@@ -529,7 +558,7 @@ task :compute_dev_version do
529
558
  if build = ENV['BUILD_NUMBER'] || ENV['TRAVIS_BUILD_NUMBER']
530
559
  if branch.eql? "release"
531
560
  new_version = sprintf('%s-%s%04d-%s', version, "r", build, sha)
532
- else
561
+ else
533
562
  new_version = sprintf('%s-%04d-%s', version, build, sha)
534
563
  end
535
564
  else
@@ -543,9 +572,9 @@ desc "Runs all necessary checks on a module in preparation for a release"
543
572
  task :release_checks do
544
573
  Rake::Task[:lint].invoke
545
574
  Rake::Task[:validate].invoke
546
- begin
575
+ if parallel_tests_loaded
547
576
  Rake::Task[:parallel_spec].invoke
548
- rescue RuntimeError
577
+ else
549
578
  Rake::Task[:spec].invoke
550
579
  end
551
580
  Rake::Task["check:symlinks"].invoke
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
- VERSION = "2.3.2"
2
+ VERSION = "2.4.0"
3
3
 
4
4
  # compat for pre-1.2.0 users; deprecated
5
5
  module Version
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: 2.3.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-08-11 00:00:00.000000000 Z
12
+ date: 2017-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  version: '0'
216
216
  requirements: []
217
217
  rubyforge_project:
218
- rubygems_version: 2.5.2
218
+ rubygems_version: 2.5.1
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Standard tasks and configuration for module spec tests.