Skip to content

Conversation

@bajajneha27
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea.
  • Follow the instructions in CONTRIBUTING. Most importantly, ensure the tests and linter pass by running bundle exec rake ci in the gem subdirectory.
  • Update code documentation if necessary.

closes: b/228274210

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label May 10, 2022
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch from c8bba11 to c10217e Compare May 12, 2022 07:34
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch 2 times, most recently from af1f30d to 1262e47 Compare June 9, 2022 08:48
@bajajneha27 bajajneha27 added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 9, 2022
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch 4 times, most recently from e558204 to 2e60107 Compare June 20, 2022 05:26
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch from 2e60107 to fe58b5d Compare June 28, 2022 09:11
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch 3 times, most recently from e7a0dd5 to 5331212 Compare July 7, 2022 11:07
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch 4 times, most recently from c597c25 to 61c96a4 Compare July 18, 2022 11:32
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch from 61c96a4 to 361c371 Compare August 22, 2022 09:08
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch 2 times, most recently from af561fa to 5686331 Compare September 7, 2022 16:10
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch from 3297f9c to b64fa30 Compare September 12, 2022 11:21
@bajajneha27 bajajneha27 marked this pull request as ready for review September 15, 2022 05:45
@bajajneha27 bajajneha27 requested review from a team as code owners September 15, 2022 05:45
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch from 790e0a3 to b88be1b Compare September 20, 2022 10:54
@bajajneha27 bajajneha27 removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Sep 26, 2022
@bajajneha27 bajajneha27 force-pushed the storage/retry-conformance branch from 10a3309 to 25c4c16 Compare September 26, 2022 14:03
end
end

#Conformance Tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add space here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


success_result = true
begin
run_retry_test test_id, lib_func, scenario["preconditionProvided"], method.resources
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why scenario["preconditionProvided"] & not scenario.preconditionProvided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No specific reason. Since it was a JSON key, I used the string

# The Retry Test API in the testbench is used to run the retry conformance tests. It offers a
# mechanism to describe more complex
# retry scenarios while sending a single, constant header through all the HTTP requests from a
# test program. The Retry Test API can be accessed by adding the path "/retry-test" to the host. # See also: https://github.com/googleapis/storage-testbench
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Limit to 80 characters. # See also.... can move to next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

object = resources[:object]
object_2 = bucket.create_file StringIO.new(CONF_TEST_FILE_CONTENT), "my-test-file-2"
destination = "new-composite-object"
if _preconditions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

underscored variable used.

def self.delete_file client, _preconditions, **resources
bucket = resources[:bucket]
object = resources[:object]
if _preconditions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. underscored variable

def self.patch_file client, _preconditions, **resources
bucket = resources[:bucket]
object = resources[:object]
if _preconditions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

def self.rewrite_file client, _preconditions, **resources
bucket = resources[:bucket]
object = resources[:object]
if _preconditions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

end
end

#Conformance Tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@bajajneha27 bajajneha27 requested a review from tritone September 28, 2022 04:37
end

def self.insert_bucket client, _preconditions, **resources
bucket_name = "new_bucket" + Time.now.to_i.to_s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. It's best to append some random digits to prevent this.


def self.bucket_acl_public client, _preconditions, **resources
bucket = resources[:bucket]
if _preconditions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1


def self.insert_object client, _preconditions, **resources
bucket = resources[:bucket]
file = StringIO.new CONF_TEST_FILE_CONTENT * 1024 * 1024 # 1MB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this is actually 1024 * 1024 * CONF_TEST_FILE_CONTENT.size which is 12MB rather than 1MB. Just making sure that's what you intend for this object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's indeed 12 MB.
We needed a use case where we're doing multi chunk upload. The default chunk size is 8MB, so needed an input bigger than that.

Copy link
Contributor

@shivgautam shivgautam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@dazuma dazuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@tritone tritone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, very clear and well factored. I know this was a big effort so thank you @bajajneha27 !

## Running the tests

The conformance tests are included in the ordinary unit test suite. In the `google-cloud-storage` directory, run `rake test`.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the emulator need to be launched separately in order to run the tests? If so worth noting how to do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does. Updated README to include that. Thanks.


def self.get
{
"storage.bucket_acl.list" => [:list_bucket_acls],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could you sort these by resource / alphabetically? Otherwise it's a bit difficult to see all of what's implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Updated it alphabetically.

"storage.buckets.setIamPolicy" => [:set_bucket_policy],
"storage.hmacKey.update" => [:update_hmac_key],
"storage.resumable.upload" => [
:blob_upload_from_string,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I notice that I think these still need to be implemented, correct? Fine to do it in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've implemented them as part of storage.objects.insert . If we need to implement more varieties of it, can be done in separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants