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

Reset S3-client object after each test #19553

Merged
merged 1 commit into from
Jan 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions shared/test/common_test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ def around(&block)
AWS::S3.stub(:random, proc {random.bytes(16).unpack('H*')[0]}, &block)
end
end

# Cached S3-client objects contain AWS credentials,
# so reset them to ensure that they are not reused across tests.
BucketHelper.s3 = nil
AWS::S3.s3 = nil

# Reset AUTO_INCREMENT, since it is unaffected by transaction rollback.
PEGASUS_TEST_TABLES.each do |table|
PEGASUS_DB.execute("ALTER TABLE `#{table}` AUTO_INCREMENT = 1")
Expand Down