For debugging leaky specs in a Circle CI container
This is a Ruby script for outputting an Rspec command from a Circle CI XML artifact. If none of those things mean anything to you, you're probably not going to find this very useful.
- Clone this repo into which folder you do things with Github r.epos.
cd
into the repo and runbundle install
- Download your Circle CI XML into the
xml/
folder. - Amend the
debug.rb
script to point to your XML file. - Amend the
debug.rb
script to assign the failure local variable to a stringy representation of the test that is failing. For example, if yourapp/models/pizza_spec.rb
file is failing intermittently, make thisfailure
variable"pizza_spec"
. - Run the script from your command line with
ruby debug.rb
. - This should print out the rspec command you need to run in order to recreate what Circle CI did.
- Hopefully your flakey spec will now fail locally.
- If it does, you can play with the script to create a divide and conquer approach to finding what preceding spec causes your
pizza_spec.rb
to fail. - Once you can reproduce the failure locally with two tests together, you can fix your flakey spec and make your life a tiny bit better.