Log In
Log In
Places
All Projects
Status Monitor
Collapse sidebar
obs:server:fedora:2.9
obs-server
obs-server-2.9-0039-ci-Add-rspec-retry.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File obs-server-2.9-0039-ci-Add-rspec-retry.patch of Package obs-server
From c9285bd5855f4a69998b0ef2aeaca061a8de02b9 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer <cbruckmayer@suse.com> Date: Mon, 2 Apr 2018 17:32:31 +0200 Subject: [PATCH] [ci] Add rspec-retry and enable it for feature tests. Some feature tests fail randomly in the package build in OBS with timeouts. Hopefully retrying the same test three times will solve this problem. --- src/api/Gemfile | 2 ++ src/api/Gemfile.lock | 3 +++ src/api/spec/browser_helper.rb | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/api/Gemfile b/src/api/Gemfile index 9ad9af02e8..9c757d3c7a 100644 --- a/src/api/Gemfile +++ b/src/api/Gemfile @@ -144,6 +144,8 @@ end group :development, :test do # as testing framework gem 'rspec-rails', '~> 3.5' + # to make tests not fail in package test suite + gem 'rspec-retry' # for fixtures gem 'factory_bot_rails' # for mocking the backend diff --git a/src/api/Gemfile.lock b/src/api/Gemfile.lock index 83bafafe1b..e288e0710d 100644 --- a/src/api/Gemfile.lock +++ b/src/api/Gemfile.lock @@ -319,6 +319,8 @@ GEM rspec-expectations (~> 3.5.0) rspec-mocks (~> 3.5.0) rspec-support (~> 3.5.0) + rspec-retry (0.5.7) + rspec-core (> 3.3) rspec-support (3.5.0) rubocop (0.51.0) parallel (~> 1.10) @@ -484,6 +486,7 @@ DEPENDENCIES redcarpet responders (~> 2.0) rspec-rails (~> 3.5) + rspec-retry rubocop rubocop-rspec ruby-ldap diff --git a/src/api/spec/browser_helper.rb b/src/api/spec/browser_helper.rb index 938aadb433..f87abcfeec 100644 --- a/src/api/spec/browser_helper.rb +++ b/src/api/spec/browser_helper.rb @@ -10,3 +10,24 @@ require 'support/features/features_authentication' # Shared examples. Per recommendation of RSpec, # https://www.relishapp.com/rspec/rspec-core/v/2-12/docs/example-groups/shared-examples Dir['./spec/support/shared_examples/features/*.rb'].each { |example| require example } + +require 'rspec/retry' +RSpec.configure do |config| + # 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 + + # callback to be run between retries + config.retry_callback = proc do |ex| + # run some additional clean up task - can be filtered by example metadata + if ex.metadata[:js] + Capybara.reset! + end + end +end -- 2.20.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Contact
Support
@OBShq
The Open Build Service is an
openSUSE project
.
Log In
Places
Places
All Projects
Status Monitor