Skip to content
Merged

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from knack.util import CLIError

from azure.cli.testsdk import (
ResourceGroupPreparer, RoleBasedServicePrincipalPreparer, ScenarioTest, live_only)
ResourceGroupPreparer, RoleBasedServicePrincipalPreparer, VirtualNetworkPreparer, ScenarioTest, live_only)
from azure_devtools.scenario_tests import AllowLargeResponse
from azure.cli.testsdk.checkers import (StringContainCheck, StringContainCheckIgnoreCase)
from azure.cli.command_modules.acs._format import version_to_tuple
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_aks_create_service_no_wait(self, resource_group, resource_group_locatio
self.check('agentPoolProfiles[0].vmSize', 'Standard_DS2_v2'),
self.check('dnsPrefix', '{dns_name_prefix}'),
self.check('provisioningState', 'Succeeded'),
self.check('addonProfiles.httpapplicationrouting.enabled', True)
self.check('addonProfiles.httpApplicationRouting.enabled', True)
])

# delete
Expand Down Expand Up @@ -248,7 +248,7 @@ def test_aks_create_scale_with_custom_nodepool_name(self, resource_group, resour
self.check('agentPoolProfiles[0].name', '{nodepool_name}'),
self.check('dnsPrefix', '{dns_name_prefix}'),
self.check('provisioningState', 'Succeeded'),
self.check('addonProfiles', None)
self.check('addonProfiles.KubeDashboard.enabled', False)
])

# scale up
Expand Down Expand Up @@ -462,11 +462,14 @@ def test_aks_create_default_service_with_monitoring_addon(self, resource_group,

# TODO: Remove when issue #9392 is addressed.
@live_only()
@AllowLargeResponse()
@ResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2')
@RoleBasedServicePrincipalPreparer()
@VirtualNetworkPreparer()
def test_aks_create_default_service_with_virtual_node_addon(self, resource_group, resource_group_location, sp_name, sp_password):
# kwargs for string formatting
aks_name = self.create_random_name('cliakstest', 16)
subnet_id = self.cmd('network vnet subnet show --resource-group {rg} --vnet-name {vnet} --name default').get_output_in_json()['id']
self.kwargs.update({
'resource_group': resource_group,
'name': aks_name,
Expand All @@ -475,14 +478,15 @@ def test_aks_create_default_service_with_virtual_node_addon(self, resource_group
'location': resource_group_location,
'service_principal': _process_sp_name(sp_name),
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
'resource_type': 'Microsoft.ContainerService/ManagedClusters',
'subnet_id': subnet_id
})

# 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 ' \
'--aci-subnet-name foo --vnet-subnet-id bar'
'--aci-subnet-name foo --vnet-subnet-id "{subnet_id}"'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a validator to check that --vnet-subnet-id should be a resource id.

This test still fails with Operation failed with status: 'Bad Request'. Details: ACI Connector requires azure network plugin, leave that to AKS team to fix.

self.cmd(create_cmd, checks=[
self.exists('fqdn'),
self.exists('nodeResourceGroup'),
Expand Down
15 changes: 9 additions & 6 deletions src/azure-cli/azure/cli/command_modules/advisor/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ def enable_recommendations(client, ids=None, resource_group_name=None, recommend

for rec in recs:
for sup in all_sups:
if sup.suppression_id in rec.suppression_ids:
result = _parse_recommendation_uri(rec.id)
client.suppressions.delete(
resource_uri=result['resource_uri'],
recommendation_id=result['recommendation_id'],
name=sup.name)
try:
if sup.suppression_id in rec.suppression_ids:
result = _parse_recommendation_uri(rec.id)
client.suppressions.delete(
resource_uri=result['resource_uri'],
recommendation_id=result['recommendation_id'],
name=sup.name)
except TypeError: # when rec.id is already suppressed, rec.suppression_ids is None
pass
rec.suppression_ids = None

return recs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_recommendations(self):
self.check("[0].suppressionIds", None)])

def test_recommendations_resource_group(self):
resource_group = 'AzExpertStg'
resource_group = 'cli-live-test-rg'
self.kwargs.update({
'resource_group': resource_group
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ def test_azconfig_import_export(self, resource_group, location):

class AppConfigAppServiceImportExportLiveScenarioTest(LiveScenarioTest):

@AllowLargeResponse()
@ResourceGroupPreparer(parameter_name_for_location='location')
def test_appconfig_to_appservice_import_export(self, resource_group, location):
config_store_name = self.create_random_name(prefix='ImportExportTest', length=24)
Expand Down Expand Up @@ -1985,7 +1984,6 @@ def test_azconfig_key_validation(self, resource_group, location):

class AppConfigAadAuthLiveScenarioTest(LiveScenarioTest):

@AllowLargeResponse()
@ResourceGroupPreparer(parameter_name_for_location='location')
def test_azconfig_aad_auth(self, resource_group, location):
config_store_name = self.create_random_name(prefix='AadTest', length=15)
Expand Down Expand Up @@ -2046,7 +2044,7 @@ def test_azconfig_aad_auth(self, resource_group, location):
})

# Before assigning data reader role, read operation should fail with AAD auth
with self.assertRaisesRegex(CLIError, "Operation returned an invalid status 'Forbidden'"):
with self.assertRaisesRegex(CLIError, "Operation returned an invalid status 'Unauthorized'"):
self.cmd('appconfig kv show --endpoint {endpoint} --auth-mode login --key {key}')

# Assign data reader role to current user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,42 @@ interactions:
ParameterSetName:
- -n -g --kind --sku -l --yes
User-Agent:
- python/3.7.3 (Darwin-19.5.0-x86_64-i386-64bit) msrest/0.6.13 msrest_azure/0.6.3
azure-mgmt-cognitiveservices/2.0.0 Azure-SDK-For-Python AZURECLI/2.5.1
- python/3.6.8 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-cognitiveservices/6.3.0 Azure-SDK-For-Python AZURECLI/2.14.0
accept-language:
- en-US
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cs_cli_test_000002?api-version=2017-04-18
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cs_cli_test_000002","name":"cs_cli_test_000002","type":"Microsoft.CognitiveServices/accounts","etag":"\"00009e1a-0000-3300-0000-5ed6c6990000\"","location":"centraluseuap","sku":{"name":"S0"},"kind":"Face","properties":{"endpoint":"https://centraluseuap.api.cognitive.microsoft.com/","internalId":"568bc92c08f74d6aacdcb71c0f2c41f9","dateCreated":"2020-06-02T21:37:29.4924764Z","privateEndpointConnections":[],"publicNetworkAccess":"Enabled","provisioningState":"Creating"}}'
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cs_cli_test_000002","name":"cs_cli_test_000002","type":"Microsoft.CognitiveServices/accounts","etag":"\"02001114-0000-3300-0000-5f9907aa0000\"","location":"centraluseuap","sku":{"name":"S0"},"kind":"Face","properties":{"endpoint":"https://centraluseuap.api.cognitive.microsoft.com/","internalId":"767b57d3a0fd430d948cbe4797d38965","dateCreated":"2020-10-28T05:54:49.952909Z","callRateLimit":{"rules":[{"key":"face","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"face/v1.0/*","method":"*"}]},{"key":"container.billing","renewalPeriod":10,"count":500,"matchPatterns":[{"path":"billing/*","method":"*"}]},{"key":"default","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"*","method":"*"}]}]},"privateEndpointConnections":[],"publicNetworkAccess":"Enabled","capabilities":[{"name":"VirtualNetworks"},{"name":"Container","value":"Face.*,Face.Face"}],"provisioningState":"Creating"}}'
headers:
azure-asyncoperation:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/centraluseuap/operationResults/e37dad10-6467-4833-a0e9-2215520a9c6f?api-version=2017-04-18
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/centraluseuap/operationResults/c3133b4c-370f-4fca-9854-2480e0816a71?api-version=2017-04-18
cache-control:
- no-cache
content-length:
- '665'
- '1084'
content-type:
- application/json; charset=utf-8
date:
- Tue, 02 Jun 2020 21:37:29 GMT
- Wed, 28 Oct 2020 05:54:51 GMT
etag:
- '"00009e1a-0000-3300-0000-5ed6c6990000"'
- '"02001114-0000-3300-0000-5f9907aa0000"'
expires:
- '-1'
pragma:
- no-cache
server:
- Microsoft-IIS/10.0
- istio-envoy
strict-transport-security:
- max-age=31536000; includeSubDomains
x-aspnet-version:
- 4.0.30319
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '390'
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
x-powered-by:
- ASP.NET
status:
code: 201
message: Created
Expand All @@ -73,44 +71,95 @@ interactions:
ParameterSetName:
- -n -g
User-Agent:
- python/3.7.3 (Darwin-19.5.0-x86_64-i386-64bit) msrest/0.6.13 msrest_azure/0.6.3
azure-mgmt-cognitiveservices/2.0.0 Azure-SDK-For-Python AZURECLI/2.5.1
- python/3.6.8 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-cognitiveservices/6.3.0 Azure-SDK-For-Python AZURECLI/2.14.0
accept-language:
- en-US
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cs_cli_test_000002?api-version=2017-04-18
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cs_cli_test_000002","name":"cs_cli_test_000002","type":"Microsoft.CognitiveServices/accounts","etag":"\"00009e1a-0000-3300-0000-5ed6c6990000\"","location":"centraluseuap","sku":{"name":"S0"},"kind":"Face","properties":{"endpoint":"https://centraluseuap.api.cognitive.microsoft.com/","internalId":"568bc92c08f74d6aacdcb71c0f2c41f9","dateCreated":"2020-06-02T21:37:29.4924764Z","privateEndpointConnections":[],"publicNetworkAccess":"Enabled","provisioningState":"Creating"}}'
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cs_cli_test_000002","name":"cs_cli_test_000002","type":"Microsoft.CognitiveServices/accounts","etag":"\"02001514-0000-3300-0000-5f9907ab0000\"","location":"centraluseuap","sku":{"name":"S0"},"kind":"Face","properties":{"endpoint":"https://centraluseuap.api.cognitive.microsoft.com/","internalId":"767b57d3a0fd430d948cbe4797d38965","dateCreated":"2020-10-28T05:54:49.952909Z","callRateLimit":{"rules":[{"key":"face","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"face/v1.0/*","method":"*"}]},{"key":"container.billing","renewalPeriod":10,"count":500,"matchPatterns":[{"path":"billing/*","method":"*"}]},{"key":"default","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"*","method":"*"}]}]},"privateEndpointConnections":[],"publicNetworkAccess":"Enabled","capabilities":[{"name":"VirtualNetworks"},{"name":"Container","value":"Face.*,Face.Face"}],"provisioningState":"Succeeded"}}'
headers:
cache-control:
- no-cache
content-length:
- '665'
- '1085'
content-type:
- application/json; charset=utf-8
date:
- Tue, 02 Jun 2020 21:37:30 GMT
- Wed, 28 Oct 2020 05:54:53 GMT
etag:
- '"00009e1a-0000-3300-0000-5ed6c6990000"'
- '"02001514-0000-3300-0000-5f9907ab0000"'
expires:
- '-1'
pragma:
- no-cache
server:
- Microsoft-IIS/10.0
- istio-envoy
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-aspnet-version:
- 4.0.30319
x-content-type-options:
- nosniff
x-powered-by:
- ASP.NET
x-envoy-upstream-service-time:
- '25'
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- cognitiveservices account show
Connection:
- keep-alive
ParameterSetName:
- -n -g
User-Agent:
- python/3.6.8 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-cognitiveservices/6.3.0 Azure-SDK-For-Python AZURECLI/2.14.0
accept-language:
- en-US
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cs_cli_test_000002?api-version=2017-04-18
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cs_cli_test_000002","name":"cs_cli_test_000002","type":"Microsoft.CognitiveServices/accounts","etag":"\"02001514-0000-3300-0000-5f9907ab0000\"","location":"centraluseuap","sku":{"name":"S0"},"kind":"Face","properties":{"endpoint":"https://centraluseuap.api.cognitive.microsoft.com/","internalId":"767b57d3a0fd430d948cbe4797d38965","dateCreated":"2020-10-28T05:54:49.952909Z","callRateLimit":{"rules":[{"key":"face","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"face/v1.0/*","method":"*"}]},{"key":"container.billing","renewalPeriod":10,"count":500,"matchPatterns":[{"path":"billing/*","method":"*"}]},{"key":"default","renewalPeriod":1,"count":15,"matchPatterns":[{"path":"*","method":"*"}]}]},"privateEndpointConnections":[],"publicNetworkAccess":"Enabled","capabilities":[{"name":"VirtualNetworks"},{"name":"Container","value":"Face.*,Face.Face"}],"provisioningState":"Succeeded"}}'
headers:
cache-control:
- no-cache
content-length:
- '1085'
content-type:
- application/json; charset=utf-8
date:
- Wed, 28 Oct 2020 05:55:09 GMT
etag:
- '"02001514-0000-3300-0000-5f9907ab0000"'
expires:
- '-1'
pragma:
- no-cache
server:
- istio-envoy
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '23'
status:
code: 200
message: OK
Expand All @@ -130,8 +179,8 @@ interactions:
ParameterSetName:
- -n -g
User-Agent:
- python/3.7.3 (Darwin-19.5.0-x86_64-i386-64bit) msrest/0.6.13 msrest_azure/0.6.3
azure-mgmt-cognitiveservices/2.0.0 Azure-SDK-For-Python AZURECLI/2.5.1
- python/3.6.8 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-cognitiveservices/6.3.0 Azure-SDK-For-Python AZURECLI/2.14.0
accept-language:
- en-US
method: DELETE
Expand All @@ -141,31 +190,29 @@ interactions:
string: ''
headers:
azure-asyncoperation:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/centraluseuap/operationResults/1afc069f-dc1d-47af-be1c-f7b476873a8e?api-version=2016-02-01-preview
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/centraluseuap/operationResults/7a1ca6bd-04db-484a-bee7-bbaf78eb48c9?api-version=2017-04-18
cache-control:
- no-cache
content-length:
- '0'
date:
- Tue, 02 Jun 2020 21:37:32 GMT
- Wed, 28 Oct 2020 05:55:11 GMT
expires:
- '-1'
location:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/centraluseuap/operationResults/1afc069f-dc1d-47af-be1c-f7b476873a8e?api-version=2016-02-01-preview&operationResultResponseType=Location
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/centraluseuap/operationResults/7a1ca6bd-04db-484a-bee7-bbaf78eb48c9?api-version=2017-04-18&operationResultResponseType=Location
pragma:
- no-cache
server:
- Microsoft-IIS/10.0
- istio-envoy
strict-transport-security:
- max-age=31536000; includeSubDomains
x-aspnet-version:
- 4.0.30319
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '343'
x-ms-ratelimit-remaining-subscription-deletes:
- '14999'
x-powered-by:
- ASP.NET
status:
code: 202
message: Accepted
Expand Down
Loading