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

Address weirdness in snippets test bucket generator #694

Closed
unforced opened this issue Jan 18, 2022 · 2 comments
Closed

Address weirdness in snippets test bucket generator #694

unforced opened this issue Jan 18, 2022 · 2 comments
Labels
api: storage Issues related to the googleapis/python-storage API.

Comments

@unforced
Copy link
Contributor

@dandhlee helped point out a weirdness in the rpo_test in our recent turbo replication change, that was copied over from snippets_test.
Just want to highlight this here to ensure we take a look and also to inquire if someone knows if there's a reason why we did it this way.
As dan pointed out, if the bucket exists, an infinite loop would be created, and so I'm kind of confused about what's happening here.

https://github.com/googleapis/python-storage/blob/main/samples/snippets/snippets_test.py#L106
https://github.com/googleapis/python-storage/blob/main/samples/snippets/snippets_test.py#L121
https://github.com/googleapis/python-storage/blob/main/samples/snippets/snippets_test.py#L154

#622

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/python-storage API. label Jan 18, 2022
@cojenco
Copy link
Contributor

cojenco commented Jan 18, 2022

I recall this is to ensure that the bucket fixture created has a non-existent bucket_name

while bucket is None or bucket.exists():
    bucket_name = "storage-snippets-test-{}".format(uuid.uuid4())
    bucket = storage.Client().bucket(bucket_name)

The while loop is broke out once bucket_name = "storage-snippets-test-{}".format(uuid.uuid4()) is non-existent and unique, so there wouldn't be an infinite loop.

@unforced
Copy link
Contributor Author

Ahhhh that makes sense

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/python-storage API.
Projects
None yet
Development

No branches or pull requests

2 participants