diff --git a/build_tools/spec/changelog_spec.rb b/build_tools/spec/changelog_spec.rb index f2c767d1ec8..37dc2b4a6bc 100644 --- a/build_tools/spec/changelog_spec.rb +++ b/build_tools/spec/changelog_spec.rb @@ -3,7 +3,7 @@ require_relative 'spec_helper' module BuildTools - describe Changelog do + describe Changelog, :jruby_flaky do let(:path) { Tempfile.create('file').path } let(:expected_changelog) { <<-LOG diff --git a/gems/aws-sdk-core/spec/aws/plugins/endpoint_discovery_spec.rb b/gems/aws-sdk-core/spec/aws/plugins/endpoint_discovery_spec.rb index 3f1059da84f..b4480ebb7e8 100644 --- a/gems/aws-sdk-core/spec/aws/plugins/endpoint_discovery_spec.rb +++ b/gems/aws-sdk-core/spec/aws/plugins/endpoint_discovery_spec.rb @@ -4,7 +4,7 @@ module Aws module Plugins - describe EndpointDiscovery do + describe EndpointDiscovery, :jruby_flaky do EndpointDiscoveryClient = ApiHelper.sample_service( api: { diff --git a/gems/aws-sdk-core/spec/retry_errors_helper.rb b/gems/aws-sdk-core/spec/retry_errors_helper.rb index 342edf48f8f..93497664c05 100644 --- a/gems/aws-sdk-core/spec/retry_errors_helper.rb +++ b/gems/aws-sdk-core/spec/retry_errors_helper.rb @@ -91,7 +91,7 @@ def apply_expectations(test_case) if expected[:clock_correction] endpoint = resp.context.http_request.endpoint expect(resp.context.config.clock_skew.clock_correction(endpoint)) - .to be_within(1).of(expected[:clock_correction]) + .to be_within(5).of(expected[:clock_correction]) end end diff --git a/gems/aws-sdk-core/spec/shared_spec_helper.rb b/gems/aws-sdk-core/spec/shared_spec_helper.rb index a8413857bf6..6cee7bb4f9a 100644 --- a/gems/aws-sdk-core/spec/shared_spec_helper.rb +++ b/gems/aws-sdk-core/spec/shared_spec_helper.rb @@ -51,4 +51,20 @@ Thread.report_on_exception = current_value if current_value end + + if defined?(JRUBY_VERSION) + config.around(:each, :jruby_flaky) do |example| + attempt = 0 + retries = 3 + loop do + attempt += 1 + example.run + break if !example.exception || attempt >= retries + + # clear the exception, ensuring it can run from a clean state + example.example.instance_variable_set(:@exception, nil) + redo + end + end + end end diff --git a/gems/aws-sdk-s3/spec/object/download_file_spec.rb b/gems/aws-sdk-s3/spec/object/download_file_spec.rb index bd398a35800..6bef89df4c6 100644 --- a/gems/aws-sdk-s3/spec/object/download_file_spec.rb +++ b/gems/aws-sdk-s3/spec/object/download_file_spec.rb @@ -9,7 +9,7 @@ module S3 let(:client) { S3::Client.new(stub_responses: true) } let(:tmpdir) { Dir.tmpdir } - describe '#download_file' do + describe '#download_file', :jruby_flaky do let(:path) { Tempfile.new('destination').path } let(:small_obj) do diff --git a/gems/aws-sdk-s3/spec/object/upload_stream_spec.rb b/gems/aws-sdk-s3/spec/object/upload_stream_spec.rb index b201f8b93e7..1897f82b70e 100644 --- a/gems/aws-sdk-s3/spec/object/upload_stream_spec.rb +++ b/gems/aws-sdk-s3/spec/object/upload_stream_spec.rb @@ -8,7 +8,7 @@ module S3 describe Object do let(:client) { S3::Client.new(stub_responses: true) } - describe '#upload_stream' do + describe '#upload_stream', :jruby_flaky do let(:object) do S3::Object.new( bucket_name: 'bucket',