Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
DEV: Support running Ruby tests in parallel (discourse#7087)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmusaraj authored Feb 28, 2019
1 parent bf0c855 commit edffd00
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
--colour
--profile
--fail-fast
12 changes: 12 additions & 0 deletions lib/tasks/docker.rake
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ task 'docker:test' do
if ENV["RSPEC_SEED"]
params << "--seed #{ENV["RSPEC_SEED"]}"
end

if ENV['PARALLEL']
parts = ENV['PARALLEL'].split("/")
total = parts[1].to_i
subset = parts[0].to_i - 1

spec_partials = Dir["spec/**/*_spec.rb"].sort.in_groups(total, false)
params << spec_partials[subset].join(' ')

puts "Running spec subset #{subset + 1} of #{total}"
end

@good &&= run_or_fail("bundle exec rspec #{params.join(' ')}".strip)
end

Expand Down

0 comments on commit edffd00

Please sign in to comment.