puppetlabs_spec_helper 2.7.0 → 2.8.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: d87d6131bfee20ef40887c452db37042acdab37d
4
- data.tar.gz: a327772c292504414a79d4fd3784ff82348cad4a
3
+ metadata.gz: 560988fc4b9b6843571dd84cb9950ed4e7183b13
4
+ data.tar.gz: c0a9ecd1c637521bcbb2376e0db81805ed9c908c
5
5
  SHA512:
6
- metadata.gz: 6abed6f18fb005b07a38e19c0646716216058d88f425ea1659fd8453ac46bb17cb3135059f4f9deb2f7542609e8348e19121df1d74dc395bfaa94c9a9ec69fd8
7
- data.tar.gz: c656294475da31a64af15631968a513438291e4f1d1b0e8e3e85d60cb65029ffcfdf63a793d1f2a0982c02706b6f887ed7a0c69d1f30da9d0d7d04d4acdcfb8d
6
+ metadata.gz: 12dd845bdcfafb01e7e81d6c4d603abc1b235d175711883cdc0e73fd59cb53f6901bfe45e9b52d65333e704f7bf47a29e4d729a881f4eb91ddd5115d7739f081
7
+ data.tar.gz: 23fa34f17299df694322d9f8402fa95e4f39d7b7eb10c513022431145f709e64167fb190287afd39f96f744dd67529c24db7afe3cd4fc5a4cf294ea0f6c3fe55
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
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.8.0]
6
+ ### Summary
7
+ This feature release adds a new rake task `parallel_spec_standalone` which is a parallel version of `spec_standalone`
8
+
9
+ ### Added
10
+ - `parallel_spec_standalone` rake task
11
+ - `spec_clean_symlinks` rake task to just clean symlink fixtures, not all fixtures
12
+ - Leave downloaded fixtures on test failure to speed up test runs.
13
+ - Update already-existing fixtures instead of doing nothing to them.
14
+
5
15
  ## [2.7.0]
6
16
  ### Summary
7
17
  Feature release to begin moving away from mocha as a testing (specifically, mocking) framework for modules.
@@ -442,7 +452,8 @@ compatible yet.
442
452
  ### Added
443
453
  * Initial release
444
454
 
445
- [unreleased]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.7.0...master
455
+ [unreleased]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.8.0...master
456
+ [2.8.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.7.0...v2.8.0
446
457
  [2.7.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.6.2...v2.7.0
447
458
  [2.6.2]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.6.1...v2.6.2
448
459
  [2.6.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/v2.5.1...v2.6.1
data/README.md CHANGED
@@ -466,7 +466,7 @@ The following links may give you some insight into why...
466
466
  mock_with
467
467
  =========
468
468
 
469
- There are two major mocking frameworks in modules test suites today: [mocha](https://rubygems.org/gems/mocha) and [rspec-mocks](https://rubygems.org/gems/rspec-mocks). It is recommended to choose rspec-mocks explicitely by specifying `mock_with` either in your `spec_helper.rb` like so:
469
+ There are two major mocking frameworks in modules test suites today: [mocha](https://rubygems.org/gems/mocha) and [rspec-mocks](https://rubygems.org/gems/rspec-mocks). We recommend that you choose rspec-mocks explicitly by specifying `mock_with`, either in your `spec_helper.rb` like so:
470
470
 
471
471
  ```
472
472
  RSpec.configure do |c|
@@ -475,7 +475,7 @@ end
475
475
  require 'puppetlabs_spec_helper/module_spec_helper'
476
476
  ```
477
477
 
478
- or by using the PDK's [`mock_with` option in `.sync.yml`](https://github.com/puppetlabs/pdk-templates#specspec_helperrb) and `pdk update`.
478
+ or by using Puppet Development Kit's [`mock_with` option in `.sync.yml`](https://github.com/puppetlabs/pdk-templates#specspec_helperrb) and `pdk update`.
479
479
 
480
480
  You can also continue to use mocha by explicitly specifying `:mocha`, following the [mocha documentation](http://gofreerange.com/mocha/docs/).
481
481
 
@@ -60,13 +60,25 @@ task :spec do |t, args|
60
60
  begin
61
61
  Rake::Task[:spec_prep].invoke
62
62
  Rake::Task[:spec_standalone].invoke(*args.extras)
63
+ Rake::Task[:spec_clean].invoke
63
64
  ensure
65
+ Rake::Task[:spec_clean_symlinks].invoke
66
+ end
67
+ end
68
+
69
+ desc "Run spec tests in parallel and clean the fixtures directory if successful"
70
+ task :parallel_spec do |t, args|
71
+ begin
72
+ Rake::Task[:spec_prep].invoke
73
+ Rake::Task[:parallel_spec_standalone].invoke(*args.extras)
64
74
  Rake::Task[:spec_clean].invoke
75
+ ensure
76
+ Rake::Task[:spec_clean_symlinks].invoke
65
77
  end
66
78
  end
67
79
 
68
80
  desc "Parallel spec tests"
69
- task :parallel_spec do
81
+ task :parallel_spec_standalone do |t, args|
70
82
  raise 'Add the parallel_tests gem to Gemfile to enable this task' unless parallel_tests_loaded
71
83
  if Rake::FileList[pattern].to_a.empty?
72
84
  warn "No files for parallel_spec to run against"
@@ -76,10 +88,7 @@ task :parallel_spec do
76
88
  args.push('--').concat(ENV['CI_SPEC_OPTIONS'].strip.split(' ')).push('--') unless ENV['CI_SPEC_OPTIONS'].nil? || ENV['CI_SPEC_OPTIONS'].strip.empty?
77
89
  args.concat(Rake::FileList[pattern].to_a)
78
90
 
79
- Rake::Task[:spec_prep].invoke
80
91
  ParallelTests::CLI.new.run(args)
81
- ensure
82
- Rake::Task[:spec_clean].invoke
83
92
  end
84
93
  end
85
94
  end
@@ -117,6 +117,20 @@ module PuppetlabsSpecHelper::Tasks::FixtureHelpers
117
117
  result
118
118
  end
119
119
 
120
+ def update_repo(scm, target)
121
+ args = case scm
122
+ when 'hg'
123
+ ['pull']
124
+ when 'git'
125
+ ['fetch']
126
+ else
127
+ fail "Unfortunately #{scm} is not supported yet"
128
+ end
129
+ Dir.chdir(target) do
130
+ system("#{scm} #{args.flatten.join(' ')}")
131
+ end
132
+ end
133
+
120
134
  def revision(scm, target, ref)
121
135
  args = []
122
136
  case scm
@@ -239,7 +253,11 @@ task :spec_prep do
239
253
  logger.debug "New Thread started for #{remote}"
240
254
  # start up a new thread and store it in the opts hash
241
255
  opts[:thread] = Thread.new do
242
- clone_repo(scm, remote, target, subdir, ref, branch, flags)
256
+ if File.directory?(target)
257
+ update_repo(scm, target)
258
+ else
259
+ clone_repo(scm, remote, target, subdir, ref, branch, flags)
260
+ end
243
261
  revision(scm, target, ref) if ref
244
262
  remove_subdirectory(target, subdir) if subdir
245
263
  end
@@ -283,7 +301,8 @@ task :spec_prep do
283
301
  ref = " --version #{opts['ref']}" if not opts['ref'].nil?
284
302
  flags = " #{opts['flags']}" if opts['flags']
285
303
  end
286
- next if File::exists?(target)
304
+
305
+ next if File.directory?(target)
287
306
 
288
307
  working_dir = module_working_directory
289
308
  target_dir = File.expand_path('spec/fixtures/modules')
@@ -317,12 +336,17 @@ task :spec_clean do
317
336
 
318
337
  FileUtils::rm_rf(module_working_directory)
319
338
 
320
- fixtures("symlinks").each do |source, opts|
321
- target = opts["target"]
322
- FileUtils::rm_f(target)
323
- end
339
+ Rake::Task[:spec_clean_symlinks].invoke
324
340
 
325
341
  if File.zero?("spec/fixtures/manifests/site.pp")
326
342
  FileUtils::rm_f("spec/fixtures/manifests/site.pp")
327
343
  end
328
344
  end
345
+
346
+ desc "Clean up any fixture symlinks"
347
+ task :spec_clean_symlinks do
348
+ fixtures("symlinks").each do |source, opts|
349
+ target = opts["target"]
350
+ FileUtils::rm_f(target)
351
+ end
352
+ end
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
- VERSION = "2.7.0"
2
+ VERSION = "2.8.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.7.0
4
+ version: 2.8.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: 2018-04-12 00:00:00.000000000 Z
12
+ date: 2018-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  requirements: []
220
220
  rubyforge_project:
221
- rubygems_version: 2.6.8
221
+ rubygems_version: 2.6.14
222
222
  signing_key:
223
223
  specification_version: 4
224
224
  summary: Standard tasks and configuration for module spec tests.