DZone

If your RSpec test suite runs for hours, you could shorten that to just minutes with parallel jobs using Buildkite agents. You will learn how to run parallel tests in optimal CI build time for your Ruby on Rails project. I will also show you a few useful things for Buildkite CI like:

  • A real RSpec test suite taking 13 hours and 32 minutes executed in only 5 minutes 20 seconds by using 151 parallel Buildkite agents with knapsack_pro Ruby gem.
  • How to distribute test files between parallel jobs using Queue Mode in Knapsack Pro to utilize CI machines optimally.
  • A simple example of CI Buildkite parallelism config.
  • An advanced example of Buildkite config with Elastic CI Stack for AWS.
  • Why you might want to use AWS Spot Instances.
  • How to automatically split slow RSpec test files by test examples (test cases) between parallel Buildkite agents.

A Real R Spec Test Suite Taking 13 Hours and Executed in Only 5 Minutes

I’d like to show you the results of a real project for running RSpec parallel tests. The project we are looking at here is huge and its RSpec tests run time is 13 hours and 32 minutes. It’s super slow. You can imagine creating a git commit and waiting 13 hours to find out the next day that your code breaks something else in the project. You can’t work like that!

Source: DZone