Skip to content

Commit

Permalink
Add minitest retry for flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
senhalil committed Sep 23, 2021
1 parent 359c1db commit 3941e44
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ end
group :test do
gem 'minitest'
gem 'minitest-around' # to create a block around unit tests for initialisation and cleanup
gem 'minitest-bisect' # to identify randomly failing order-depoendent tests
gem 'minitest-bisect' # useful for identifing randomly failing order-depoendent tests
gem 'minitest-focus'
gem 'minitest-reporters'
gem 'minitest-retry' # relaunches selected methods when they fail
gem 'minitest-stub_any_instance'
gem 'rack-test'
gem 'simplecov', require: false
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ GEM
builder
minitest (>= 5.0)
ruby-progressbar
minitest-retry (0.2.2)
minitest (>= 5.0)
minitest-server (1.0.6)
minitest (~> 5.0)
minitest-stub_any_instance (1.0.2)
Expand Down Expand Up @@ -316,6 +318,7 @@ DEPENDENCIES
minitest-bisect
minitest-focus
minitest-reporters
minitest-retry
minitest-stub_any_instance
nokogiri
oj
Expand Down
18 changes: 18 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@
ENV['TIME'] && Minitest::Reporters::SpecReporter.new, # Generate a report to find slowest tests
].compact

require 'minitest/retry'
Minitest::Retry.use!(
# List of methods that will trigger a retry (when empty, all methods will).
# The list respects alphabetical order for easy maintenance
methods_to_retry: %w[
Api::V01::OutputTest#test_csv_configuration_asynchronously
Api::V01::OutputTest#test_csv_headers_compatible_with_import_according_to_language
Api::V01::OutputTest#test_returned_ids
Api::V01::OutputTest#test_returned_types
Api::V01::OutputTest#test_use_deprecated_csv_headers_asynchronously
Api::V01::WithSolverTest#test_deleted_job
DichotomiousTest#test_dichotomious_approach
SplitClusteringTest#test_avoid_capacities_overlap
SplitClusteringTest#test_no_doubles_3000
WrapperTest#test_detecting_unfeasible_services_can_not_take_too_long
]
)

require 'grape'
require 'grape-swagger'
require 'grape-entity'
Expand Down

0 comments on commit 3941e44

Please sign in to comment.