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
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def generate_ssh_keys(cls):
return pathname


@unittest.skip("skip acs tests as it's deprected")
class AzureContainerServiceKubernetesScenarioTest(ScenarioTest):

# the length is set to avoid following error:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
# flake8: noqa


# The RoleBasedServicePrincipalPreparer returns sp name and needs to be turned
# into Application ID URI. Based on the recording files, some Application ID (GUID)
# is set with the environment varibale for sp_name. This method is compatible with
# both cases.
def _process_sp_name(sp_name):
from azure.cli.core.util import is_guid
return sp_name if is_guid(sp_name) else 'http://{}'.format(sp_name)


class AzureKubernetesServiceScenarioTest(ScenarioTest):

@AllowLargeResponse()
Expand All @@ -36,7 +45,7 @@ def test_aks_create_default_service(self, resource_group, resource_group_locatio
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'tags': tags,
'nodepool_labels': nodepool_labels,
Expand Down Expand Up @@ -125,7 +134,7 @@ def test_aks_create_service_no_wait(self, resource_group, resource_group_locatio
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'k8s_version': create_version,
'vm_size': 'Standard_DS2_v2'
Expand Down Expand Up @@ -208,7 +217,7 @@ def test_aks_create_scale_with_custom_nodepool_name(self, resource_group, resour
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': 'http://' + sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'k8s_version': create_version,
'nodepool_name': self.create_random_name('np', 12)
Expand Down Expand Up @@ -270,7 +279,7 @@ def test_aks_create_default_service_without_skip_role_assignment(self, resource_
'resource_group': resource_group,
'name': aks_name,
'location': resource_group_location,
'service_principal': 'http://' + sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'vnet_subnet_id': self.generate_vnet_subnet_id(resource_group)
})
Expand Down Expand Up @@ -315,7 +324,7 @@ def test_aks_create_default_service_with_skip_role_assignment(self, resource_gro
'resource_group': resource_group,
'name': aks_name,
'location': resource_group_location,
'service_principal': 'http://' + sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'vnet_subnet_id': self.generate_vnet_subnet_id(resource_group)
})
Expand Down Expand Up @@ -371,7 +380,7 @@ def test_aks_create_default_service_with_monitoring_addon(self, resource_group,
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': 'http://' + sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -464,15 +473,15 @@ def test_aks_create_default_service_with_virtual_node_addon(self, resource_group
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': 'http://' + sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})

# create cluster with virtual-node addon
create_cmd = 'aks create --resource-group={resource_group} --name={name} --location={location} ' \
'--dns-name-prefix={dns_name_prefix} --node-count=1 --ssh-key-value={ssh_key_value} ' \
'--service-principal={service_principal} --client-secret={client_secret} --enable-addons virtual-node' \
'--service-principal={service_principal} --client-secret={client_secret} --enable-addons virtual-node ' \
'--aci-subnet-name foo --vnet-subnet-id bar'
self.cmd(create_cmd, checks=[
self.exists('fqdn'),
Expand Down Expand Up @@ -549,7 +558,7 @@ def test_aks_create_blb_vmas(self, resource_group, resource_group_location, sp_n
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -620,7 +629,7 @@ def test_aks_create_default_setting(self, resource_group, resource_group_locatio
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -704,7 +713,7 @@ def test_aks_create_private_cluster_then_update(self, resource_group, resource_g
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -793,7 +802,7 @@ def test_aks_create_cluster_with_apiserver_authorized_ranges_then_update(self, r
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -884,7 +893,7 @@ def test_aks_create_slb_vmss_with_default_mgd_outbound_ip_then_update(self, reso
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -982,7 +991,7 @@ def test_aks_create_slb_vmss_with_outbound_ip_then_update(self, resource_group,
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -1085,7 +1094,7 @@ def test_aks_create_slb_vmss_with_outbound_ip_prefixes_then_update(self, resourc
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -1189,7 +1198,7 @@ def test_aks_nodepool_create_scale_delete(self, resource_group, resource_group_l
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters',
'tags': tags,
Expand Down Expand Up @@ -1309,7 +1318,7 @@ def test_aks_nodepool_system_pool(self, resource_group, resource_group_location,
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters',
'tags': tags,
Expand Down Expand Up @@ -1420,7 +1429,7 @@ def test_aks_availability_zones(self, resource_group, resource_group_location, s
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters',
'nodepool1_name': nodepool1_name,
Expand Down Expand Up @@ -1492,7 +1501,7 @@ def test_aks_managed_identity_with_service_principal(self, resource_group, resou
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -1575,7 +1584,7 @@ def test_aks_create_with_paid_sku(self, resource_group, resource_group_location,
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})
Expand Down Expand Up @@ -1609,7 +1618,7 @@ def test_aks_create_with_windows(self, resource_group, resource_group_location,
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters',
'windows_admin_username': 'azureuser1',
Expand Down Expand Up @@ -1662,7 +1671,7 @@ def test_aks_create_with_ahub(self, resource_group, resource_group_location, sp_
'dns_name_prefix': self.create_random_name('cliaksdns', 16),
'ssh_key_value': self.generate_ssh_keys().replace('\\', '\\\\'),
'location': resource_group_location,
'service_principal': sp_name,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters',
'windows_admin_username': 'azureuser1',
Expand Down