-
Notifications
You must be signed in to change notification settings - Fork 28
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
Can't get parallelization to work. #1083
Comments
@vincentpaca we will take a look and get back to you. Quick question - is the problem that the tests do not get split across the minions at all, or is it more that the report isn't being shown correctly? |
Hey @manishas , it definitely runs 9 different minions but it runs all the specs on each minion. |
Have you taken a look at our sample - https://github.com/shippableSamples/sample-rubyonrails-parallel-matrix-rspec for this scenario? That runs a subset of tests on each minion and outputs results to the test tab. Please make sure you follow the instructions there. Also tagging @CADBOT to help further. |
That is where I actually based my configuration too. I'll give it another go now to make sure that I just didn't miss a config or something. Thanks @manishas. |
Hey @vincentpaca ! While your shippable.yml file is looking correct, the problem is in the Rakefile. The shippable.yml file sets the different env vars for each minion in your parallel build, but your Rakefile must then use this variable to select a subset of the possible tests; without this additional bit of logic, each of your minions you create in the matrix will run all your tests. I'll breakdown how it works in the sample project Manisha linked you to in our sample # Ported from https://github.com/cloudcastle/cucumber_in_groups
require 'active_support/core_ext/array/grouping'
if ENV['TEST_GROUP']
ENV['TEST_GROUP'] =~ /^(\d+)of(\d+)$/
group = $1.to_i
groups_no = $2.to_i
specs = (Dir['./**/*_spec.rb']).sort.in_groups(groups_no, false)
specs_to_run = specs[group - 1]
else
specs_to_run = Dir['./**/*_spec.rb']
end
specs_to_run.each do |file|
require file
end The above is the test code trigged by our rakefile. What it's doing is based on what value the TEST_GROUP env var is set to in this minion (being 1of3 2of3 or 3of3 in our case) a different set of tests will be ran. The $1 and $2 global variables are set by this line ENV['TEST_GROUP'] =~ /^(\d+)of(\d+)$/ In our case for the TEST_GROUP=1of3 minion group = 1 and group_no = 3. specs = (Dir['./**/*_spec.rb']).sort.in_groups(groups_no, false) And based on the current group number, select one of the 3 groups we made specs_to_run = specs[group - 1] Finally, we iterate through the group of tests we selected for our minion, and run each one specs_to_run.each do |file|
require file
end Sorry if that was a little long winded, but I wanted to make sure you have all the information you need to unblock yourself! If you need more info, feel free to reach out to me at charlie@shippable.com . We can set up a google hangout, skype, or phone call, and work our way through it! |
Hey @CADBOT , thanks for clearing that up. That helped a lot, and I've got the parallel specs running now. The issue was just |
Glad to hear it @vincentpaca ! Keep in touch with any further questions or needs! |
Thanks @CADBOT . Sent you an email too. |
@vincentpaca since you're working with @CADBOT and the parallelization works, so I'm closing this issue. |
I'm trying to configure my rails app to build in parallel tests and my
shippable.yml
currently looks like this.Rakefile:
I can't make it play nice with parallel tests. I got the code coverage reports to work, but the test splitting doesn't.
Any insight would be really helpful.
The text was updated successfully, but these errors were encountered: