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

fix: update gRPC object list implementation to include synthetic directories #1824

Merged
merged 1 commit into from Jan 3, 2023

Conversation

BenWhitehead
Copy link
Collaborator

Rework list centric tests in ITObjectTest to have more straightforward implementations and assertions, and in some cases a more clear name of what is being validated. (Removed all the list retry stuff, object list is strongly consistent in GCS.)

@@ -186,46 +179,6 @@ public void testGetBlobKmsKeyNameField() {
assertNull(remoteBlob.getContentType());
}

@Test(timeout = 5000)
public void testListBlobsKmsKeySelectedFields() throws InterruptedException {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test was "testing" if an object with a kms key would have said kms key populated in a list response. Field masks and mapping are verified elsewhere, deleting here.

Storage.BlobListOption.fields(BlobField.METADATA));
// Listing blobs is eventually consistent, we loop until the list is of the expected size. The
// test fails if timeout is reached.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Listing objects is strongly consistent[1], we don't need the manual retry loop here.

[1] https://cloud.google.com/storage/docs/consistency#strongly_consistent_operations

Storage.BlobListOption.prefix("test-list-blobs-empty-selected-fields-blob"),
Storage.BlobListOption.fields());
// Listing blobs is eventually consistent, we loop until the list is of the expected size. The
// test fails if timeout is reached.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Listing objects is strongly consistent[1], we don't need the manual retry loop here.

[1] https://cloud.google.com/storage/docs/consistency#strongly_consistent_operations

Storage.BlobListOption.prefix("test-list-blobs-current-directory/"),
Storage.BlobListOption.currentDirectory());
// Listing blobs is eventually consistent, we loop until the list is of the expected size. The
// test fails if timeout is reached.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Listing objects is strongly consistent[1], we don't need the manual retry loop here.

[1] https://cloud.google.com/storage/docs/consistency#strongly_consistent_operations

}

@Test
public void testListBlobsMultiplePages() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since we're having to walk the pages ourselves now, add a test to verify we are doing it accurately.

started = true;
action.accept(seed);
prev = seed;
private static <T> Stream<T> streamIterate(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No actual code change to this helper method, simply un-nested it from TransformingPageDecorator

Copy link
Member

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

LGTM, had one question on annotation removal

@@ -63,7 +57,6 @@
@CrossRun(
transports = {Transport.HTTP, Transport.GRPC},
backends = Backend.PROD)
@ParallelFriendly
Copy link
Member

Choose a reason for hiding this comment

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

was this intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I found a time where this tests was not parallel friendly as some object names weren't unique across CrossRun's and one deleted resources of the other. We can bring this back once we have hermetic object names.

…ctories

Rework ITObjectTest.testListBlobsCurrentDirectory to have a more descriptive name
along with a more straight forward implementation and assertions. (Removed all the
listing retry stuff, object list is strongly consistent in GCS.)

* test: remove obsolete test which is validating field mask which is tested separately
@BenWhitehead BenWhitehead merged commit 0665c24 into main Jan 3, 2023
@BenWhitehead BenWhitehead deleted the grpc/obj/list/directories branch January 3, 2023 23:09
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 googleapis/java-storage API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants