-
Notifications
You must be signed in to change notification settings - Fork 567
feat(storage): setting default checksum #30878
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
base: main
Are you sure you want to change the base?
feat(storage): setting default checksum #30878
Conversation
| @@ -1805,6 +1805,7 @@ def create_file file, | |||
| path ||= file.path if file.respond_to? :path | |||
| path ||= file if file.is_a? String | |||
| raise ArgumentError, "must provide path" if path.nil? | |||
| checksum = :crc32c if checksum.nil? && crc32c.nil? && md5.nil? | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document this clearly in an appropriate, that Crc32c will be used by default for integrity checks
| @@ -1091,6 +1111,10 @@ def empty_file_gapi cache_control: nil, content_disposition: nil, | |||
| content_encoding: nil, content_language: nil, | |||
| content_type: nil, crc32c: nil, md5: nil, metadata: nil, | |||
| storage_class: nil | |||
| # Set crc32c if both md5 and crc32c are not provided | |||
| if md5.nil? && crc32c.nil? | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is repeated multiple times across test files, do we have a common test helper where it could be moved.
| @@ -610,7 +646,7 @@ | |||
|
|
|||
| it "creates an file with a StringIO" do | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: a
| new_file_name = random_file_path | ||
| new_file_contents = StringIO.new "Hello world" | ||
| mock = Minitest::Mock.new | ||
| mock.expect :insert_object, create_file_gapi(bucket.name, new_file_name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are we verifying the checksum for the new String IO object here, also use a slightly different string in different tests for robustness
This change sets Checksum CRC32C as default when we are uploading a file to bucket