NoRedInk/rspec-retry

Rspec Retry causing error: Errno::EPIPE: Broken pipe

csalvato opened this issue · 1 comments

We currently use rspec-retry with the following configuration in our spec_helper.rb file:

require "codeclimate-test-reporter"
require 'rspec/retry'

CodeClimate::TestReporter.start
FakeBraintree.activate!

RSpec.configure do |config|
  config.before do
    FakeBraintree.clear!
  end

  config.include ShowMeTheCookies, :type => :feature

  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  # rspec-mocks config goes here. You can use an alternate test double
  # library (such as bogus or mocha) by changing the `mock_with` option here.
  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
    mocks.verify_doubled_constant_names = true
    # Prevents you from mocking or stubbing a method that does not exist on
    # a real object. This is generally recommended, and will default to
    # `true` in RSpec 4.
    config.around(:each, type: :helper) do |ex|
      config.mock_with :rspec do |mocks|
        mocks.verify_partial_doubles = false
        ex.run
        mocks.verify_partial_doubles = true
      end
    end
  end

  # show retry status in spec process
  config.verbose_retry = true
  # show exception that triggers a retry if verbose_retry is set to true
  config.display_try_failure_messages = true

  # run retry only on features
  config.around :each, :js do |ex|
    ex.run_with_retry retry: 3
  end

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = :random

  config.raise_errors_for_deprecations!
end

On our CI we sporadically see these errors on various different specs:

Got 0 failures and 3 other errors:

     1.1) Failure/Error: visit root_path(r: @campaign_code, utm_campaign: "foo", utm_source: "bar", utm_medium: "baz")
          
          Errno::EPIPE:
            Broken pipe
          # ./spec/features/funnel/checkout_spec.rb:22:in `block (2 levels) in <top (required)>'
          # ./spec/spec_helper.rb:46:in `block (2 levels) in <top (required)>'

     1.2) Failure/Error: ex.run_with_retry retry: 3
          
          Errno::EPIPE:
            Broken pipe
          # ./spec/spec_helper.rb:46:in `block (2 levels) in <top (required)>'

     1.3) Failure/Error: ex.run_with_retry retry: 3
          
          Errno::EPIPE:
            Broken pipe
          # ./spec/spec_helper.rb:46:in `block (2 levels) in <top (required)>'

While the specs are always different, the pattern is the same:

  1. Visit some path - get Broken Pipe
  2. ex.run_with_retry retry: 3 - get Broken Pipe
  3. ex.run_with_retry retry: 3 - get Broken Pipe

Since we are doing 3 tries, it looks like there's a broken pipe on the first try on line 46 of spec_helper.rb:

  # run retry only on features
  config.around :each, :js do |ex|
    ex.run_with_retry retry: 3
  end

I'm having a hell of a time debugging this issue, but it seems like something is sporadically breaking our retry process. I haven't found anyone else with this issue through Google, and am not quite sure how to debug it from here.

Any thoughts?

Doing more research on my end, it seems like this is related to Poltergeist/PhantomJS, not RSpec::Retry. Closing for now. :) Thanks!