-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(storage): support delete_source_objects in compose API #17015
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
f23963c
178694c
f42c0f9
a982960
fc96097
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4480,6 +4480,43 @@ def test_compose_wo_content_type_set(self): | |
| _target_object=destination, | ||
| ) | ||
|
|
||
| def test_compose_w_delete_source_objects(self): | ||
| source_1_name = "source-1" | ||
| source_2_name = "source-2" | ||
| destination_name = "destination" | ||
| delete_source_objects = True | ||
| api_response = {} | ||
| client = mock.Mock(spec=["_post_resource"]) | ||
| client._post_resource.return_value = api_response | ||
| bucket = _Bucket(client=client) | ||
| source_1 = self._make_one(source_1_name, bucket=bucket) | ||
| source_2 = self._make_one(source_2_name, bucket=bucket) | ||
| destination = self._make_one(destination_name, bucket=bucket) | ||
|
|
||
| destination.compose( | ||
| sources=[source_1, source_2], | ||
| delete_source_objects=delete_source_objects, | ||
| ) | ||
|
|
||
| expected_path = f"/b/name/o/{destination_name}/compose" | ||
| expected_data = { | ||
| "sourceObjects": [ | ||
| {"name": source_1.name, "generation": source_1.generation}, | ||
| {"name": source_2.name, "generation": source_2.generation}, | ||
| ], | ||
| "destination": {}, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this is empty?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jules check why is this empty?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the test to set
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @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. |
||
| "deleteSourceObjects": delete_source_objects, | ||
| } | ||
| expected_query_params = {} | ||
| client._post_resource.assert_called_once_with( | ||
| expected_path, | ||
| expected_data, | ||
| query_params=expected_query_params, | ||
| timeout=self._get_default_timeout(), | ||
| retry=DEFAULT_RETRY_IF_GENERATION_SPECIFIED, | ||
| _target_object=destination, | ||
| ) | ||
|
|
||
| def test_compose_minimal_w_user_project_w_timeout(self): | ||
| source_1_name = "source-1" | ||
| source_2_name = "source-2" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.