Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release_checks without parallel_tests #211

Merged
merged 3 commits into from
Sep 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions lib/puppetlabs_spec_helper/rake_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
# ignore
end

parallel_tests_loaded = false
begin
require 'parallel_tests'
parallel_tests_loaded = true
rescue LoadError
# ignore
end


task :default => [:help]

pattern = 'spec/{aliases,classes,defines,unit,functions,hosts,integration,type_aliases,types}/**/*_spec.rb'
Expand Down Expand Up @@ -388,17 +397,14 @@ def max_thread_limit

desc "Parallel spec tests"
task :parallel_spec do
raise 'Add the parallel_tests gem to Gemfile to enable this task' unless parallel_tests_loaded
begin
require 'parallel_tests'

args = ['-t', 'rspec']
args.push('--').concat(ENV['CI_SPEC_OPTIONS'].strip.split(' ')).push('--') unless ENV['CI_SPEC_OPTIONS'].nil? || ENV['CI_SPEC_OPTIONS'].strip.empty?
args.concat(Rake::FileList[pattern].to_a)

Rake::Task[:spec_prep].invoke
ParallelTests::CLI.new.run(args)
rescue LoadError
raise 'Add the parallel_tests gem to Gemfile to enable this task'
ensure
Rake::Task[:spec_clean].invoke
end
Expand Down Expand Up @@ -552,9 +558,9 @@ def max_thread_limit
task :release_checks do
Rake::Task[:lint].invoke
Rake::Task[:validate].invoke
begin
if parallel_tests_loaded
Rake::Task[:parallel_spec].invoke
rescue RuntimeError
else
Rake::Task[:spec].invoke
end
Rake::Task["check:symlinks"].invoke
Expand Down