diff options
author | Sanad Liaquat <sliaquat@gitlab.com> | 2019-02-19 15:12:07 +0300 |
---|---|---|
committer | Sanad Liaquat <sliaquat@gitlab.com> | 2019-02-19 15:12:07 +0300 |
commit | d54cb37d29a9f02e210a5e5b4ada6169fc0cf9fb (patch) | |
tree | 0fde26ae2b7e331deaf84587fb0b322b01129c97 /qa/spec/spec_helper.rb | |
parent | 503061217e010e74d155464be7dfd8e9754776db (diff) |
Retry failed tests with rspec-retry
Does not retry if tagged :quarantine. Also adds unit tests.
Diffstat (limited to 'qa/spec/spec_helper.rb')
-rw-r--r-- | qa/spec/spec_helper.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index 20a153f3f63..cbdd6e881b1 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -1,4 +1,5 @@ require_relative '../qa' +require 'rspec/retry' %w[helpers shared_examples].each do |d| Dir[::File.join(__dir__, d, '**', '*.rb')].each { |f| require f } @@ -31,6 +32,17 @@ RSpec.configure do |config| config.profile_examples = 10 config.order = :random Kernel.srand config.seed + + # 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 + + config.around do |example| + retry_times = example.metadata.keys.include?(:quarantine) ? 1 : 3 + example.run_with_retry retry: retry_times + end end # Skip tests in quarantine unless we explicitly focus on them. |