Skip to content

Commit

Permalink
Add retry behavior to help with persistently flaky tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
GUI committed Apr 17, 2024
1 parent 172285e commit a92d4aa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ gem "minitest-reporters", "~> 1.6.0"
# For an "after_all" callback.
gem "minitest-hooks", "~> 1.5.0"

# Retry certain flaky tests.
gem "minitest-retry", "~> 0.2.2"

# Test metadata for CI environment.
gem "minitest-ci", "~> 3.4.0"

Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ GEM
builder
minitest (>= 5.0)
ruby-progressbar
minitest-retry (0.2.2)
minitest (>= 5.0)
minitest-sprint (1.2.2)
path_expander (~> 1.1)
multi_json (1.15.0)
Expand Down Expand Up @@ -213,6 +215,7 @@ DEPENDENCIES
minitest-ci (~> 3.4.0)
minitest-hooks (~> 1.5.0)
minitest-reporters (~> 1.6.0)
minitest-retry (~> 0.2.2)
minitest-sprint (~> 1.2.0)
multi_json (~> 1.15.0)
net-smtp (~> 0.5.0)
Expand Down
13 changes: 13 additions & 0 deletions test/support/retry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# While not ideal, retry certain flaky tests in CI.
if ENV["CI"] == "true"
require "minitest/retry"
Minitest::Retry.use!(
methods_to_retry: [
"Test::AdminUi::TestApis#test_form",
],

exceptions_to_retry: [
Selenium::WebDriver::Error::UnknownError,
],
)
end

0 comments on commit a92d4aa

Please sign in to comment.