DEV: Add --profile and --fail-fast when running plugin specs, tweak parallel test balancing
This commit is contained in:
parent
28547c6f08
commit
a5b804fec4
|
@ -139,7 +139,8 @@ task 'docker:test' do
|
||||||
spec_partials = Dir["spec/**/*_spec.rb"].sort.in_groups(total, false)
|
spec_partials = Dir["spec/**/*_spec.rb"].sort.in_groups(total, false)
|
||||||
# quick and dirty load balancing
|
# quick and dirty load balancing
|
||||||
if (spec_partials.count > 3)
|
if (spec_partials.count > 3)
|
||||||
spec_partials[0].concat(spec_partials[total - 1].shift(40))
|
spec_partials[0].concat(spec_partials[total - 1].shift(30))
|
||||||
|
spec_partials[1].concat(spec_partials[total - 2].shift(30))
|
||||||
end
|
end
|
||||||
|
|
||||||
params << spec_partials[subset].join(' ')
|
params << spec_partials[subset].join(' ')
|
||||||
|
@ -154,7 +155,7 @@ task 'docker:test' do
|
||||||
if ENV["SINGLE_PLUGIN"]
|
if ENV["SINGLE_PLUGIN"]
|
||||||
@good &&= run_or_fail("bundle exec rake plugin:spec['#{ENV["SINGLE_PLUGIN"]}']")
|
@good &&= run_or_fail("bundle exec rake plugin:spec['#{ENV["SINGLE_PLUGIN"]}']")
|
||||||
else
|
else
|
||||||
@good &&= run_or_fail("bundle exec rake plugin:spec")
|
@good &&= run_or_fail("RSPEC_FAILFAST=1 bundle exec rake plugin:spec")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
puts "travis_fold:end:ruby_tests" if ENV["TRAVIS"]
|
puts "travis_fold:end:ruby_tests" if ENV["TRAVIS"]
|
||||||
|
|
|
@ -86,10 +86,11 @@ end
|
||||||
desc 'run plugin specs'
|
desc 'run plugin specs'
|
||||||
task 'plugin:spec', :plugin do |t, args|
|
task 'plugin:spec', :plugin do |t, args|
|
||||||
args.with_defaults(plugin: "*")
|
args.with_defaults(plugin: "*")
|
||||||
|
params = ENV['RSPEC_FAILFAST'] ? '--profile --fail-fast' : '--profile'
|
||||||
ruby = `which ruby`.strip
|
ruby = `which ruby`.strip
|
||||||
files = Dir.glob("./plugins/#{args[:plugin]}/spec/**/*_spec.rb")
|
files = Dir.glob("./plugins/#{args[:plugin]}/spec/**/*_spec.rb")
|
||||||
if files.length > 0
|
if files.length > 0
|
||||||
sh "LOAD_PLUGINS=1 #{ruby} -S rspec #{files.join(' ')}"
|
sh "LOAD_PLUGINS=1 #{ruby} -S rspec #{files.join(' ')} #{params}"
|
||||||
else
|
else
|
||||||
abort "No specs found."
|
abort "No specs found."
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue