feat(storage): support delete_source_objects in compose API#17015
feat(storage): support delete_source_objects in compose API#17015nidhiii-27 wants to merge 5 commits into
Conversation
Implements the delete_source_objects parameter in Blob.compose() to allow automatic deletion of source objects upon successful composition. Reference PR: googleapis/google-cloud-java#12873 Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request introduces the delete_source_objects parameter to the Blob.compose method, allowing source objects to be automatically deleted after a successful composition. The changes include updates to the method signature, docstrings, and request payload construction, along with a new unit test to verify the functionality. I have no feedback to provide.
Implements the delete_source_objects parameter in Blob.compose() to allow automatic deletion of source objects upon successful composition. Also adds unit and system tests to verify the new parameter. Reference PR: googleapis/google-cloud-java#12873 Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
| {"name": source_1.name, "generation": source_1.generation}, | ||
| {"name": source_2.name, "generation": source_2.generation}, | ||
| ], | ||
| "destination": {}, |
There was a problem hiding this comment.
Updated the test to set content_type on the destination blob, ensuring the destination property in the request body is not empty.
There was a problem hiding this comment.
@chandra-siri This was empty because this field is usually populated for any metadata that needs to be added to the destination object. In the new commit, content_type is added here.
…PR feedback) - Removed unnecessary fixture usage in system test. - Ensured destination metadata is not empty in unit test by setting content_type. - verified end-to-end functionality in system test. Reference PR: googleapis/google-cloud-java#12873 Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
| try: | ||
| assert destination.download_as_bytes() == payload_1 + payload_2 | ||
| assert not source_1.exists() | ||
| assert not source_2.exists() | ||
| finally: | ||
| destination.delete() |
There was a problem hiding this comment.
if assertion fails then destination will not be deleted.
There was a problem hiding this comment.
@jules add the blobs_to_delete fixture and only append destination object, not the source objects. also make sure if assertion for source1/source2 fails, only then they should be added to the blobs_to_delete
There was a problem hiding this comment.
Added back the blobs_to_delete fixture. The code now appends the destination blob to blobs_to_delete. Source blobs are only added for cleanup if they still exist after the compose operation, ensuring they are deleted even if the primary assertion fails.
…PR feedback) - Re-added blobs_to_delete fixture in system test. - Implemented conditional cleanup for source objects in system test. - Ensured destination metadata is populated in unit test. - Verified end-to-end functionality. Reference PR: googleapis/google-cloud-java#12873 Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
Implements the delete_source_objects parameter in Blob.compose() to allow automatic deletion of source objects upon successful composition. Also adds unit and system tests to verify the new parameter and handles PR feedback. Reference PR: googleapis/google-cloud-java#12873 Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
This PR adds support for the
delete_source_objectsparameter in theBlob.composemethod of thegoogle-cloud-storagepackage. This aligns the Python SDK with feature parity in the Java SDK.Key changes:
Blob.composesignature to acceptdelete_source_objects.Blob.composedocstring.deleteSourceObjectsin the JSON request body sent to the GCS REST API.test_compose_w_delete_source_objectstotest_blob.pyto verify correct serialization.Blobpass.PR created automatically by Jules for task 5220279067164674388 started by @nidhiii-27