Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/azure-cli/azure/cli/command_modules/storage/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
from azure.cli.command_modules.storage._validators import validate_source_uri

c.register_source_uri_arguments(validator=validate_source_uri)
c.argument('requires_sync', arg_type=get_three_state_flag(),
help='Enforce that the service will not return a response until the copy is complete.'
'Not support for standard page blob.')

with self.argument_context('storage blob copy start-batch', arg_group='Copy Source') as c:
from azure.cli.command_modules.storage._validators import get_source_file_or_blob_service_client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,9 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
from azure.cli.command_modules.storage._validators import validate_source_uri

c.register_source_uri_arguments(validator=validate_source_uri)
c.argument('requires_sync', arg_type=get_three_state_flag(),
help='Enforce that the service will not return a response until the copy is complete.'
'Not support for standard page blob.')

with self.argument_context('storage blob copy start-batch', arg_group='Copy Source') as c:
from azure.cli.command_modules.storage._validators import get_source_file_or_blob_service_client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.testsdk import LiveScenarioTest, ResourceGroupPreparer, StorageAccountPreparer
from azure.cli.testsdk import LiveScenarioTest, ResourceGroupPreparer, StorageAccountPreparer, JMESPathCheck
from ..storage_test_util import StorageScenarioMixin


Expand Down Expand Up @@ -131,3 +131,25 @@ def test_storage_blob_copy_same_account_sas(self, resource_group, storage_accoun
actual_content = f.read()

self.assertEqual(expect_content, actual_content)

@ResourceGroupPreparer()
@StorageAccountPreparer(kind='storageV2')
def test_storage_blob_copy_requires_sync(self, resource_group, storage_account):
source_file = self.create_temp_file(16, full_random=True)
account_info = self.get_account_info(resource_group, storage_account)

source_container = self.create_container(account_info)
target_container = self.create_container(account_info)

self.storage_cmd('storage blob upload -c {} -f "{}" -n src', account_info,
source_container, source_file)
source_uri = self.storage_cmd('storage blob url -c {} -n src', account_info, source_container).output
self.storage_cmd('storage blob copy start -b dst -c {} --source-uri {}', account_info,
target_container, source_uri)

self.storage_cmd('storage blob upload -c {} -f "{}" -n pagesrc --type page', account_info,
source_container, source_file)
source_uri = self.storage_cmd('storage blob url -c {} -n pagesrc', account_info, source_container).output
# expect failure with page blob
self.storage_cmd_negative('storage blob copy start -b dst -c {} --source-uri {} --requires-sync', account_info,
target_container, source_uri)