Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kairu-ms committed Aug 19, 2021
1 parent 8b98977 commit 014067f
Show file tree
Hide file tree
Showing 52 changed files with 9,832 additions and 126 deletions.
6 changes: 3 additions & 3 deletions test/scenario-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export enum TestMode {
ExtNoSdk = 'extnosdk',
ExtDefaultFolder = 'ext_default_folder',
ExtNoSdkNoFlattenTrack1 = 'extnosdknoflattentrack1',
CoreTrack2 = 'coretrack2',
CoreTrack1 = 'coretrack2',
}

describe('ScenarioTest', () => {
Expand Down Expand Up @@ -120,13 +120,13 @@ describe('ScenarioTest', () => {
key = CodeGenConstants.azureCliFolder;
extraOption[key] = outputDir;
return extraOption;
} else if (testMode === TestMode.CoreTrack2) {
} else if (testMode === TestMode.CoreTrack1) {
let key = CodeGenConstants.targetMode;
extraOption[key] = TargetMode.Core;
key = CodeGenConstants.azureCliFolder;
extraOption[key] = outputDir;
key = CodeGenConstants.compatibleLevel;
extraOption[key] = CompatibleLevel.Track2;
extraOption[key] = CompatibleLevel.Track1;
return extraOption;
} else if (testMode === TestMode.ExtFlatten) {
let key = CodeGenConstants.azureCliExtFolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def vm_virtual_machine_assess_patch(client,
vm_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.assess_patches,
client.begin_assess_patches,
resource_group_name=resource_group_name,
vm_name=vm_name)

Expand Down Expand Up @@ -102,7 +102,7 @@ def vm_virtual_machine_scale_set_vm_extension_create(client,
if len(extension_parameters['instance_view']) == 0:
del extension_parameters['instance_view']
return sdk_no_wait(no_wait,
client.create_or_update,
client.begin_create_or_update,
resource_group_name=resource_group_name,
vm_scale_set_name=vm_scale_set_name,
instance_id=instance_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ def load_command_table(self, _):
g.custom_show_command('show', 'kusto_attached_database_configuration_show')
g.custom_command('create', 'kusto_attached_database_configuration_create', supports_no_wait=True)
g.generic_update_command(
'update', supports_no_wait=True, custom_func_name='kusto_attached_database_configuration_update'
'update',
supports_no_wait=True,
custom_func_name='kusto_attached_database_configuration_update',
setter_name='begin_create_or_update',
)
g.custom_command(
'delete', 'kusto_attached_database_configuration_delete', supports_no_wait=True, confirmation=True
Expand Down Expand Up @@ -118,7 +121,10 @@ def load_command_table(self, _):
g.custom_show_command('show', 'kusto_cluster_principal_assignment_show')
g.custom_command('create', 'kusto_cluster_principal_assignment_create', supports_no_wait=True)
g.generic_update_command(
'update', supports_no_wait=True, custom_func_name='kusto_cluster_principal_assignment_update'
'update',
supports_no_wait=True,
custom_func_name='kusto_cluster_principal_assignment_update',
setter_name='begin_create_or_update',
)
g.custom_command(
'delete', 'kusto_cluster_principal_assignment_delete', supports_no_wait=True, confirmation=True
Expand Down Expand Up @@ -165,7 +171,10 @@ def load_command_table(self, _):
g.custom_show_command('show', 'kusto_database_principal_assignment_show')
g.custom_command('create', 'kusto_database_principal_assignment_create', supports_no_wait=True)
g.generic_update_command(
'update', supports_no_wait=True, custom_func_name='kusto_database_principal_assignment_update'
'update',
supports_no_wait=True,
custom_func_name='kusto_database_principal_assignment_update',
setter_name='begin_create_or_update',
)
g.custom_command(
'delete', 'kusto_database_principal_assignment_delete', supports_no_wait=True, confirmation=True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def kusto_cluster_create(client,
if len(parameters['identity']) == 0:
del parameters['identity']
return sdk_no_wait(no_wait,
client.create_or_update,
client.begin_create_or_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
parameters=parameters)
Expand Down Expand Up @@ -143,7 +143,7 @@ def kusto_cluster_update(client,
if len(parameters['identity']) == 0:
del parameters['identity']
return sdk_no_wait(no_wait,
client.update,
client.begin_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
parameters=parameters)
Expand All @@ -154,7 +154,7 @@ def kusto_cluster_delete(client,
cluster_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.delete,
client.begin_delete,
resource_group_name=resource_group_name,
cluster_name=cluster_name)

Expand All @@ -164,11 +164,14 @@ def kusto_cluster_add_language_extension(client,
cluster_name,
value=None,
no_wait=False):
language_extensions_to_add = {}
if value is not None:
language_extensions_to_add['value'] = value
return sdk_no_wait(no_wait,
client.add_language_extensions,
client.begin_add_language_extensions,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
value=value)
language_extensions_to_add=language_extensions_to_add)


def kusto_cluster_detach_follower_database(client,
Expand All @@ -177,20 +180,22 @@ def kusto_cluster_detach_follower_database(client,
cluster_resource_id,
attached_database_configuration_name,
no_wait=False):
follower_database_to_remove = {}
follower_database_to_remove['cluster_resource_id'] = cluster_resource_id
follower_database_to_remove['attached_database_configuration_name'] = attached_database_configuration_name
return sdk_no_wait(no_wait,
client.detach_follower_databases,
client.begin_detach_follower_databases,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
cluster_resource_id=cluster_resource_id,
attached_database_configuration_name=attached_database_configuration_name)
follower_database_to_remove=follower_database_to_remove)


def kusto_cluster_diagnose_virtual_network(client,
resource_group_name,
cluster_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.diagnose_virtual_network,
client.begin_diagnose_virtual_network,
resource_group_name=resource_group_name,
cluster_name=cluster_name)

Expand Down Expand Up @@ -223,19 +228,22 @@ def kusto_cluster_remove_language_extension(client,
cluster_name,
value=None,
no_wait=False):
language_extensions_to_remove = {}
if value is not None:
language_extensions_to_remove['value'] = value
return sdk_no_wait(no_wait,
client.remove_language_extensions,
client.begin_remove_language_extensions,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
value=value)
language_extensions_to_remove=language_extensions_to_remove)


def kusto_cluster_start(client,
resource_group_name,
cluster_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.start,
client.begin_start,
resource_group_name=resource_group_name,
cluster_name=cluster_name)

Expand All @@ -245,7 +253,7 @@ def kusto_cluster_stop(client,
cluster_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.stop,
client.begin_stop,
resource_group_name=resource_group_name,
cluster_name=cluster_name)

Expand Down Expand Up @@ -285,7 +293,7 @@ def kusto_cluster_principal_assignment_create(client,
if principal_type is not None:
parameters['principal_type'] = principal_type
return sdk_no_wait(no_wait,
client.create_or_update,
client.begin_create_or_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
principal_assignment_name=principal_assignment_name,
Expand Down Expand Up @@ -318,7 +326,7 @@ def kusto_cluster_principal_assignment_delete(client,
principal_assignment_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.delete,
client.begin_delete,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
principal_assignment_name=principal_assignment_name)
Expand Down Expand Up @@ -359,7 +367,7 @@ def kusto_database_create(client,
'provided!')
parameters = all_parameters[0] if len(all_parameters) == 1 else None
return sdk_no_wait(no_wait,
client.create_or_update,
client.begin_create_or_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
Expand All @@ -385,7 +393,7 @@ def kusto_database_update(client,
'provided!')
parameters = all_parameters[0] if len(all_parameters) == 1 else None
return sdk_no_wait(no_wait,
client.update,
client.begin_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
Expand All @@ -398,7 +406,7 @@ def kusto_database_delete(client,
database_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.delete,
client.begin_delete,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name)
Expand All @@ -409,10 +417,13 @@ def kusto_database_add_principal(client,
cluster_name,
database_name,
value=None):
database_principals_to_add = {}
if value is not None:
database_principals_to_add['value'] = value
return client.add_principals(resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
value=value)
database_principals_to_add=database_principals_to_add)


def kusto_database_list_principal(client,
Expand All @@ -429,10 +440,13 @@ def kusto_database_remove_principal(client,
cluster_name,
database_name,
value=None):
database_principals_to_remove = {}
if value is not None:
database_principals_to_remove['value'] = value
return client.remove_principals(resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
value=value)
database_principals_to_remove=database_principals_to_remove)


def kusto_database_principal_assignment_list(client,
Expand Down Expand Up @@ -475,7 +489,7 @@ def kusto_database_principal_assignment_create(client,
if principal_type is not None:
parameters['principal_type'] = principal_type
return sdk_no_wait(no_wait,
client.create_or_update,
client.begin_create_or_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
Expand Down Expand Up @@ -511,7 +525,7 @@ def kusto_database_principal_assignment_delete(client,
principal_assignment_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.delete,
client.begin_delete,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
Expand Down Expand Up @@ -553,7 +567,7 @@ def kusto_attached_database_configuration_create(client,
if default_principals_modification_kind is not None:
parameters['default_principals_modification_kind'] = default_principals_modification_kind
return sdk_no_wait(no_wait,
client.create_or_update,
client.begin_create_or_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
attached_database_configuration_name=attached_database_configuration_name,
Expand Down Expand Up @@ -586,7 +600,7 @@ def kusto_attached_database_configuration_delete(client,
attached_database_configuration_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.delete,
client.begin_delete,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
attached_database_configuration_name=attached_database_configuration_name)
Expand Down Expand Up @@ -636,7 +650,7 @@ def kusto_data_connection_create(client,
'event_grid_data_connection is provided!')
parameters = all_parameters[0] if len(all_parameters) == 1 else None
return sdk_no_wait(no_wait,
client.create_or_update,
client.begin_create_or_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
Expand Down Expand Up @@ -668,7 +682,7 @@ def kusto_data_connection_update(client,
'event_grid_data_connection is provided!')
parameters = all_parameters[0] if len(all_parameters) == 1 else None
return sdk_no_wait(no_wait,
client.update,
client.begin_update,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
Expand All @@ -683,7 +697,7 @@ def kusto_data_connection_delete(client,
data_connection_name,
no_wait=False):
return sdk_no_wait(no_wait,
client.delete,
client.begin_delete,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
Expand All @@ -710,10 +724,14 @@ def kusto_data_connection_data_connection_validation(client,
raise CLIError('at most one of event_hub_data_connection, iot_hub_data_connection, event_grid_data_connection '
'is needed for properties!')
properties = all_properties[0] if len(all_properties) == 1 else None
parameters = {}
if data_connection_name is not None:
parameters['data_connection_name'] = data_connection_name
if properties is not None:
parameters['properties'] = properties
return sdk_no_wait(no_wait,
client.data_connection_validation,
client.begin_data_connection_validation,
resource_group_name=resource_group_name,
cluster_name=cluster_name,
database_name=database_name,
data_connection_name=data_connection_name,
properties=properties)
parameters=parameters)
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ def load_command_table(self, _):
g.custom_show_command('show', 'kusto_attached_database_configuration_show')
g.custom_command('create', 'kusto_attached_database_configuration_create', supports_no_wait=True)
g.generic_update_command(
'update',
supports_no_wait=True,
custom_func_name='kusto_attached_database_configuration_update',
setter_name='begin_create_or_update',
'update', supports_no_wait=True, custom_func_name='kusto_attached_database_configuration_update'
)
g.custom_command(
'delete', 'kusto_attached_database_configuration_delete', supports_no_wait=True, confirmation=True
Expand Down Expand Up @@ -121,10 +118,7 @@ def load_command_table(self, _):
g.custom_show_command('show', 'kusto_cluster_principal_assignment_show')
g.custom_command('create', 'kusto_cluster_principal_assignment_create', supports_no_wait=True)
g.generic_update_command(
'update',
supports_no_wait=True,
custom_func_name='kusto_cluster_principal_assignment_update',
setter_name='begin_create_or_update',
'update', supports_no_wait=True, custom_func_name='kusto_cluster_principal_assignment_update'
)
g.custom_command(
'delete', 'kusto_cluster_principal_assignment_delete', supports_no_wait=True, confirmation=True
Expand Down Expand Up @@ -171,10 +165,7 @@ def load_command_table(self, _):
g.custom_show_command('show', 'kusto_database_principal_assignment_show')
g.custom_command('create', 'kusto_database_principal_assignment_create', supports_no_wait=True)
g.generic_update_command(
'update',
supports_no_wait=True,
custom_func_name='kusto_database_principal_assignment_update',
setter_name='begin_create_or_update',
'update', supports_no_wait=True, custom_func_name='kusto_database_principal_assignment_update'
)
g.custom_command(
'delete', 'kusto_database_principal_assignment_delete', supports_no_wait=True, confirmation=True
Expand Down
Loading

0 comments on commit 014067f

Please sign in to comment.