Skip to content
Open
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
4 changes: 4 additions & 0 deletions perfkitbenchmarker/providers/azure/azure_flexible_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def _WaitForAzureAsyncOperation(self, async_url: str) -> None:
if status == 'Succeeded':
return
if status == 'Failed':
if 'ServerDropping' in stdout:
raise errors.Resource.RetryableCreationError(
f'Azure async operation failed (retryable): {stdout}'
)
raise errors.Resource.CreationError(
f'Azure async operation failed: {stdout}'
)
Expand Down
41 changes: 41 additions & 0 deletions tests/providers/azure/azure_flexible_server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,47 @@ def testCreatePostgresPremiumV2Fails(self):
with self.assertRaises(errors.Resource.CreationError):
bm_spec.relational_db._Create() # pyrefly: ignore[missing-attribute]

def testCreatePostgresPremiumV2ServerDroppingFails(self):
self.MockIssueCommand({
'rest --method PUT': [(
'',
"'Azure-AsyncOperation': 'https://management.azure.com/async_op'",
0,
)],
'rest --method GET': [(
'{"status": "Failed", "error": {"code": "ServerDropping"}}',
'',
0,
)],
})
yaml_spec = inspect.cleandoc(f"""
sysbench:
relational_db:
cloud: {provider_info.AZURE}
engine: {sql_engine_utils.FLEXIBLE_SERVER_POSTGRES}
engine_version: '13'
db_tier: GeneralPurpose
db_spec:
{provider_info.AZURE}:
machine_type: Standard_D2ds_v4
zone: eastus
db_disk_spec:
{provider_info.AZURE}:
disk_size: 128
disk_type: PremiumV2_LRS
vm_groups:
clients:
vm_spec: *default_dual_core
disk_spec: *default_500_gb
""")
bm_spec = pkb_common_test_case.CreateBenchmarkSpecFromYaml(
yaml_spec, 'sysbench'
)
bm_spec.ConstructRelationalDb()

with self.assertRaises(errors.Resource.RetryableCreationError):
bm_spec.relational_db._Create() # pyrefly: ignore[missing-attribute]

def testCreatePostgresPremiumV2NoAsyncHeader(self):
self.MockIssueCommand(
{
Expand Down