Method listing the contents of a bucket in FakeStorageRpc does not use bucket name
See original GitHub issueHello,
The implementation of the method list(String bucket, Map<Option, ?> options)
in FakeStorageRpc
does not use bucket
parameter to retrieve the files inside the bucket passed as parameter (see FakeStorageRpc.java). I’m using version 0.34.0, but it seems like in previous versions the behaviour was similar. Am I missing something ?
As a consequence, when using LocalStorageHelper
(using FakeStorageRpc
) for local testing purposes, the following code does not retrieve only the files in the bucket passed as parameter, but all files in all created buckets :
Storage storage = LocalStorageHelper.customOptions(true).getService()
[...] // creating dummy files in two separate buckets (b1 and b2)
storage.list("b1") // returns all files in b1 and b2
I double checked in the doc, listing the contents of a bucket is however defined as a supported operation.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Methods for accessing a bucket - AWS Documentation
You can access your bucket using the Amazon S3 console. Using the console UI, you can perform almost all bucket operations without having...
Read more >Listing contents of a bucket with boto3 - Stack Overflow
One way to see the contents would be: for my_bucket_object in my_bucket.objects.all(): print(my_bucket_object).
Read more >S3 — Boto3 Docs 1.26.30 documentation - Amazon AWS
The bucket name to which the upload was taking place. When using this ... Description: The list of parts was not in ascending...
Read more >Bucket operations - IBM Cloud Docs
A GET request sent to the endpoint root returns a list of buckets that are ... Bucket names may not contain consecutive dots...
Read more >AWS S3 with Java - Baeldung
Remember that S3 has a very simple structure; each bucket can store any ... name is available or not by using the doesBucketExist()...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for your replies @hzyi-google @pongad
It’s all clear now, in fact I was just confused because the
bucket
parameter is not used in the implementation oflist
method inFakeStorageRpc
.I looked to tests in
google-cloud-storage
as you suggest (BucketTest.java), but I am not able to used these tests “as-is”, since many classes are package-private (for instance, I can’t initialize aBlob
).Storage
can be mocked, and in this example, mocking alsoBlob
works, but I think it will be a good idea to implement method to test storage locally (withLocalStorageHelper
) without any mocking.The feature request is added to the backlog. Feel free to add comments here.