From 36b3f5c4d415897125a82fc733385ca999436c4e Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Wed, 11 Sep 2019 16:42:58 -0400 Subject: [PATCH] 15615: Retry failed wb1 tests twice before giving up. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- apps/workbench/test/test_helper.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb index 1d26deefa3..69cf43b1a2 100644 --- a/apps/workbench/test/test_helper.rb +++ b/apps/workbench/test/test_helper.rb @@ -348,3 +348,29 @@ end # Reset fixtures now (i.e., before any tests run). ActiveSupport::TestCase.reset_api_fixtures_now + +module Minitest + class Test + def capture_exceptions *args + begin + n = 0 + begin + yield + rescue *PASSTHROUGH_EXCEPTIONS + raise + rescue Exception => e + n += 1 + raise if n > 2 + STDERR.puts "Test failed, retrying (##{n})" + retry + end + rescue *PASSTHROUGH_EXCEPTIONS + raise + rescue Assertion => e + self.failures << e + rescue Exception => e + self.failures << UnexpectedError.new(e) + end + end + end +end -- 2.30.2