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

tests: add blobs retention policy discarding into TestRetentionPolicy… #99

Merged
merged 2 commits into from
Apr 3, 2020

Conversation

IlyaFaer
Copy link

@IlyaFaer IlyaFaer commented Apr 3, 2020

Closes #97

@IlyaFaer IlyaFaer added api: storage Issues related to the googleapis/python-storage API. testing labels Apr 3, 2020
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 3, 2020
@IlyaFaer
Copy link
Author

IlyaFaer commented Apr 3, 2020

I've tried to avoid as much requests to the service as I could, so here is how it's gonna work:

Every TestRetentionPolicy test uses one blob (or two Blob() objects, but still single blob in database). We can add one of them into list - no matter which (as they are related to the same file). On a teardown we'll just walk through these blobs and discard their policies, and then call bucket.delete(force=True) as usual.

We're adding blob into list after instancing. If test passed, we're calling pop() to delete blob from the list - it's already deleted by the test, so we don't need to take care of it anymore.

@IlyaFaer IlyaFaer added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 3, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 3, 2020
self.assertIsNone(other.retention_expiration_time)
self.assertFalse(blob.event_based_hold)
self.assertFalse(blob.temporary_hold)
self.assertIsNone(blob.retention_expiration_time)
Copy link
Author

@IlyaFaer IlyaFaer Apr 3, 2020

Choose a reason for hiding this comment

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

I think, there is an error here: other blob is already deleted (line 1806). Most likely, blob was going to be here, as it's just has been uploaded and there is no asserts for it.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch

@IlyaFaer IlyaFaer marked this pull request as ready for review April 3, 2020 16:13
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.

Thanks @IlyaFaer LGTM

self.assertIsNone(other.retention_expiration_time)
self.assertFalse(blob.event_based_hold)
self.assertFalse(blob.temporary_hold)
self.assertIsNone(blob.retention_expiration_time)
Copy link
Member

Choose a reason for hiding this comment

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

Good catch

@frankyn frankyn merged commit 5c04eef into googleapis:master Apr 3, 2020
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
googleapis#99)

* tests: add blobs retention policy discarding into TestRetentionPolicy() teardown

* merging error fix
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
googleapis#99)

* tests: add blobs retention policy discarding into TestRetentionPolicy() teardown

* merging error fix
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. cla: yes This human has signed the Contributor License Agreement. testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestRetentionPolicy: bucket deletion conflict on teardown
4 participants