Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rspec retry for :jruby_flaky #2928

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build_tools/spec/changelog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module Aws
module Plugins
describe EndpointDiscovery do
describe EndpointDiscovery, :jruby_flaky do

EndpointDiscoveryClient = ApiHelper.sample_service(
api: {
Expand Down
2 changes: 1 addition & 1 deletion gems/aws-sdk-core/spec/retry_errors_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions gems/aws-sdk-core/spec/shared_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion gems/aws-sdk-s3/spec/object/download_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gems/aws-sdk-s3/spec/object/upload_stream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading