-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Runs the test suite split across nodes. We introduce a script `test_splitter` to handle splitting up the test suite based on the number of nodes. I don't know of a good way to avoid having to perform the set up on each node but as the bulk of the run time is spent on the tests this is a worthwhile trade off IMO.
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# Use on ci to split tests by file type and split them across ci nodes | ||
|
||
all_specs = Dir["spec/**/*_spec.rb"] | ||
|
||
case ENV["SPEC_TYPE"] | ||
when "unit" | ||
specs = all_specs.reject { |path| /\Aspec\/features\//.match? path } | ||
when "feature" | ||
specs = all_specs.select { |path| /\Aspec\/features\//.match? path } | ||
else | ||
specs = all_specs | ||
end | ||
|
||
number_of_ci_nodes = ENV.fetch("CI_NODE_TOTAL").to_i | ||
|
||
this_ci_node = ENV.fetch("CI_NODE_INDEX").to_i | ||
|
||
number_of_slices = (specs.size / number_of_ci_nodes.to_f).ceil | ||
|
||
specs_split_across_nodes = specs.each_slice(number_of_slices).to_a | ||
|
||
specs_to_run_on_this_node = specs_split_across_nodes[this_ci_node] | ||
|
||
print specs_to_run_on_this_node.join(" ") |