X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/71f76a45195266c2d25a42c13b1419b000d60ffb..ee5443faad325b16047b9ad4cd588baf51e231fa:/apps/workbench/test/test_helper.rb diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb index 6d8474edae..2e8ead94cd 100644 --- a/apps/workbench/test/test_helper.rb +++ b/apps/workbench/test/test_helper.rb @@ -64,7 +64,7 @@ class ActiveSupport::TestCase # Restore configuration settings changed during tests ConfigLoader.copy_into_config $arvados_config, Rails.configuration ConfigLoader.copy_into_config $remaining_config, Rails.configuration - Rails.configuration.Services.Controller.ExternalURL = "https://#{ENV['ARVADOS_API_HOST']}" + Rails.configuration.Services.Controller.ExternalURL = URI("https://#{ENV['ARVADOS_API_HOST']}") Rails.configuration.TLS.Insecure = true end end @@ -158,7 +158,7 @@ class ActiveSupport::TestCase } end def json_response - Oj.load(@response.body) + Oj.safe_load(@response.body) end end @@ -348,3 +348,30 @@ 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 || e.is_a?(Skip) + STDERR.puts "Test failed, retrying (##{n})" + ActiveSupport::TestCase.reset_api_fixtures_now + retry + end + rescue *PASSTHROUGH_EXCEPTIONS + raise + rescue Assertion => e + self.failures << e + rescue Exception => e + self.failures << UnexpectedError.new(e) + end + end + end +end