NoRedInk/rspec-retry

Retry does not work for some cases in latest rspec

allenwq opened this issue ยท 10 comments

The example given in the readme does not work in rspec 3.5 :

it 'should randomly succeed', :retry => 3 do
  expect(rand(2)).to eq(1)
end

When the expectation does not match, seems rspec does not treat it as an exception anymore. so example.exception will still be nil and this line will pass: https://github.com/NoRedInk/rspec-retry/blob/master/lib/rspec/retry.rb#L116

However, if it's a real exception like below, the retry works at expected:

it 'should randomly succeed', :retry => 3 do
  raise Network:Timeout
end

will look into this one. Thank you!

I encountered same behavior with aggregate_failures.

When I turn off aggregate_failures, it works as expected.

Fwiw, I was not able to reproduce this in RSpec 3.6.0.

Reproduced this in RSpec 3.8.0.

I can confirm that it does not work when aggregate_failures is enabled.

My focus has moved away from Ruby, so I'm not going to get to look at this. Happy to accept any PRs and / or share maintainer responsibility if anyone else has the cycles.

@michaelglass this was discussed here: rspec/rspec-core#2289
I found that rspec-retry is based on simple example.exception check which is not enough when aggregate_failures is on. I am able to monkey-patch successfully in my project and can open a PR during the week.

@iSarCasm were you able to monkey-patch it? can you post at least the code here?

@michaelglass this was discussed here: rspec/rspec-core#2289
I found that rspec-retry is based on simple example.exception check which is not enough when aggregate_failures is on. I am able to monkey-patch successfully in my project and can open a PR during the week.

@iSarCasm were you able to monkey-patch it? can you post at least the code here?

Bumping to ask if someone can fix this or provide alternatives. I have no retries when using :aggregate_failures, which I'm using to not repeat requests over multiple its.

I no longer have write access to the repo and will no longer maintain it.