Skip to content

Commit

Permalink
Revert change to testing md5 in sqs
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Apr 29, 2024
1 parent fd2554f commit 4cf966c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
15 changes: 13 additions & 2 deletions gems/aws-sdk-s3/lib/aws-sdk-s3/plugins/md5s.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,26 @@ def update_in_chunks(digest, io)
end

option(:compute_checksums,
default: true,
doc_type: 'Boolean',
docstring: <<-DOCS)
docstring: <<-DOCS
When `true` a MD5 checksum will be computed and sent in the Content Md5
header for :put_object and :upload_part. When `false`, MD5 checksums
will not be computed for these operations. Checksums are still computed
for operations requiring them. Checksum errors returned by Amazon S3 are
automatically retried up to `:retry_limit` times.
DOCS
) do |config|
# By default, we will disable checksum verification when response
# stubbing is enable. If a user decides to enable both features,
# then they will need to stub the MD5s in the response.
# See the spec/aws/sqs/client/verify_checksums_spec.rb for
# examples of how to do this.
if config.respond_to?(:stub_responses)
!config.stub_responses
else
config.verify_checksums
end
end

def add_handlers(handlers, config)
if config.compute_checksums
Expand Down
10 changes: 10 additions & 0 deletions gems/aws-sdk-sqs/spec/client/verify_checksums_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ class Client
expect(client.config.verify_checksums).to be(true)
end

it 'is disabled when response stubbing is enabled' do
client = Client.new(stub_responses: true)
expect(client.config.verify_checksums).to be(false)
end

it 'can be enabled with response stubbing is enabled' do
client = Client.new(stub_responses: true, verify_checksums: true)
expect(client.config.verify_checksums).to be(true)
end

describe '#send_message' do
let(:md5_of_attributes) { '756d7f4338696745d063b420a2f7e502' }
let(:md5_of_system_attributes) { '756d7f4338696745d063b420a2f7e502' }
Expand Down

0 comments on commit 4cf966c

Please sign in to comment.