question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Method listing the contents of a bucket in FakeStorageRpc does not use bucket name

See original GitHub issue

Hello,

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:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
norbjdcommented, Feb 15, 2018

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 of list method in FakeStorageRpc.

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 a Blob).

Storage can be mocked, and in this example, mocking also Blob works, but I think it will be a good idea to implement method to test storage locally (with LocalStorageHelper) without any mocking.

0reactions
yihanzhencommented, Feb 21, 2018

The feature request is added to the backlog. Feel free to add comments here.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found