Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AKS] Adds ignore-pod-disruption-budget flag to aks nodepool delete command #30196

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from

Conversation

tonychen15
Copy link
Contributor

@tonychen15 tonychen15 commented Oct 25, 2024

Related command
az aks nodepool delete

Description
Add --ignore-pod-disruption-budget option for ignoring PodDisruptionBudget. This will expedite the nodepool deletion which may be delayed or blocked by PDB.

Testing Guide
Use the command az aks nodepool delete --ignore-pod-disruption-budget to send the request to aks.

History Notes
[AKS] az aks nodepool delete: Add --ignore-pod-disruption-budget option for ignoring PodDisruptionBudget


This checklist is used to make sure that common guidelines for a pull request are followed.

Copy link

azure-client-tools-bot-prd bot commented Oct 25, 2024

❌AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
❌acs
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_aks_create_with_windows_gmsa self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f47fadd2030>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f47fd00e6c0>
command = 'aks nodepool delete --resource-group=clitest000001 --cluster-name=cliakstest000001 --name=npwin --no-wait'
expect_failure = False

    def in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0

src/azure-cli-testsdk/azure/cli/testsdk/base.py:302: 
                                        
env/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:129: in exception_handler
    return handle_exception(ex)
src/azure-cli-testsdk/azure/cli/testsdk/patches.py:33: in handle_main_exception
    raise ex
env/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:733: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:121: in handler
    return op(**command_args)
src/azure-cli/azure/cli/command_modules/acs/custom.py:2651: in aks_agentpool_delete
    return sdk_no_wait(
src/azure-cli-core/azure/cli/core/util.py:708: in sdk_no_wait
    return func(*args, **kwargs)
env/lib/python3.12/site-packages/azure/core/tracing/decorator.py:94: in wrapper_use_tracer
    return func(*args, **kwargs)
env/lib/python3.12/site-packages/azure/mgmt/containerservice/v2024_09_01/operations/agent_pools_operations.py:1088: in begin_delete
    raw_result = self.delete_initial(
env/lib/python3.12/site-packages/azure/mgmt/containerservice/v2024_09_01/operations/agent_pools_operations.py:1023: in delete_initial
    pipeline_response: PipelineResponse = self.client.pipeline.run(  # pylint: disable=protected-access
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:229: in run
    return first_node.send(pipeline_request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/mgmt/core/policies/base.py:47: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/redirect.py:197: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/retry.py:532: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/authentication.py:147: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:118: in send
    self.sender.send(request.http_request, **request.context.options),
env/lib/python3.12/site-packages/azure/core/pipeline/transport/requests_basic.py:355: in send
    response = self.session.request(  # type: ignore
env/lib/python3.12/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
env/lib/python3.12/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
env/lib/python3.12/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:715: in urlopen
    httplib_response = self.make_request(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:458: in make_request
    httplib_response = conn.getresponse(buffering=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
          

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_gmsa.yaml object at 0x7f47fac57b60>
 = False, kwargs = {'buffering': True}

    def getresponse(self, 
=False, **kwargs):
        """Retrieve the response"""
        # Check to see if the cassette has a response for this request. If so,
        # then return it
        if self.cassette.can_play_response_for(self.vcr_request):
            log.info(f"Playing response for {self.vcr_request} from cassette")
            response = self.cassette.play_response(self.vcr_request)
            return VCRHTTPResponse(response)
        else:
            if self.cassette.write_protected and self.cassette.filter_request(self.vcr_request):
>               raise CannotOverwriteExistingCassetteException(
                    cassette=self.cassette,
                    failed_request=self.vcr_request,
                )
E               vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_gmsa.yaml') in your current record mode ('once').
E               No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.12/site-packages/vcr/stubs/init.py:263: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.acs.tests.latest.test_aks_commands.AzureKubernetesServiceScenarioTest testMethod=test_aks_create_with_windows_gmsa>
resource_group = 'clitest000001', resource_group_location = 'centraluseuap'

    @AllowLargeResponse()
    @AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='centraluseuap')
    def test_aks_create_with_windows_gmsa(self, resource_group, resource_group_location):
        # reset the count so in replay mode the random names will start with 0
        self.test_resources_count = 0
        # kwargs for string formatting
        aks_name = self.create_random_name('cliakstest', 16)
        self.kwargs.update({
            'resource_group': resource_group,
            'name': aks_name,
            'dns_name_prefix': self.create_random_name('cliaksdns', 16),
            'location': resource_group_location,
            'resource_type': 'Microsoft.ContainerService/ManagedClusters',
            'windows_admin_username': 'azureuser1',
            'windows_admin_password': 'replace-Password1234$',
            'nodepool2_name': 'npwin',
            'ssh_key_value': self.generate_ssh_keys()
        })
    
        # create
        create_cmd = 'aks create --resource-group={resource_group} --name={name} --location={location} ' <br>                     '--dns-name-prefix={dns_name_prefix} --node-count=1 ' <br>                     '--windows-admin-username={windows_admin_username} --windows-admin-password={windows_admin_password} ' <br>                     '--load-balancer-sku=standard --vm-set-type=virtualmachinescalesets --network-plugin=azure ' <br>                     '--ssh-key-value={ssh_key_value} --enable-windows-gmsa --yes ' <br>                     '--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AKSWindowsGmsaPreview'
        self.cmd(create_cmd, checks=[
            self.exists('fqdn'),
            self.exists('nodeResourceGroup'),
            self.check('provisioningState', 'Succeeded'),
            self.check('windowsProfile.adminUsername', 'azureuser1'),
            self.check('windowsProfile.gmsaProfile.enabled', 'True')
        ])
    
        # nodepool add
        self.cmd('aks nodepool add --resource-group={resource_group} --cluster-name={name} --name={nodepool2_name} --os-type Windows --node-count=1', checks=[
            self.check('provisioningState', 'Succeeded')
        ])
    
        # nodepool delete
>       self.cmd(
            'aks nodepool delete --resource-group={resource_group} --cluster-name={name} --name={nodepool2_name} --no-wait', checks=[self.is_empty()])

src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:7963: 
 
 
 
 
 
 
                                  
src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:251: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
 
                                       

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f47fadd2030>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f47fd00e6c0>
command = 'aks nodepool delete --resource-group=clitest000001 --cluster-name=cliakstest000001 --name=npwin --no-wait'
expect_failure = False

    def _in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
            self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
            self.output = stdout_buf.getvalue()
            self.applog = logging_buf.getvalue()
    
        except CannotOverwriteExistingCassetteException as ex:
>           raise AssertionError(ex)
E           AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_gmsa.yaml') in your current record mode ('once').
E           No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E           Matchers failed :
E           _custom_request_query_matcher - assertion failure :
E           None

src/azure-cli-testsdk/azure/cli/testsdk/base.py:307: AssertionError
azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:7922
Failed test_aks_create_with_windows_msi self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f47fab362d0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f47fd0351c0>
command = 'aks nodepool delete --resource-group=clitest000001 --cluster-name=cliakstest000001 --name=npwin --no-wait'
expect_failure = False

    def in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0

src/azure-cli-testsdk/azure/cli/testsdk/base.py:302: 
                                        
env/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:129: in exception_handler
    return handle_exception(ex)
src/azure-cli-testsdk/azure/cli/testsdk/patches.py:33: in handle_main_exception
    raise ex
env/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:733: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:121: in handler
    return op(**command_args)
src/azure-cli/azure/cli/command_modules/acs/custom.py:2651: in aks_agentpool_delete
    return sdk_no_wait(
src/azure-cli-core/azure/cli/core/util.py:708: in sdk_no_wait
    return func(*args, **kwargs)
env/lib/python3.12/site-packages/azure/core/tracing/decorator.py:94: in wrapper_use_tracer
    return func(*args, **kwargs)
env/lib/python3.12/site-packages/azure/mgmt/containerservice/v2024_09_01/operations/agent_pools_operations.py:1088: in begin_delete
    raw_result = self.delete_initial(
env/lib/python3.12/site-packages/azure/mgmt/containerservice/v2024_09_01/operations/agent_pools_operations.py:1023: in delete_initial
    pipeline_response: PipelineResponse = self.client.pipeline.run(  # pylint: disable=protected-access
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:229: in run
    return first_node.send(pipeline_request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/mgmt/core/policies/base.py:47: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/redirect.py:197: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/retry.py:532: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/authentication.py:147: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:118: in send
    self.sender.send(request.http_request, **request.context.options),
env/lib/python3.12/site-packages/azure/core/pipeline/transport/requests_basic.py:355: in send
    response = self.session.request(  # type: ignore
env/lib/python3.12/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
env/lib/python3.12/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
env/lib/python3.12/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:715: in urlopen
    httplib_response = self.make_request(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:458: in make_request
    httplib_response = conn.getresponse(buffering=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
          

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_msi.yaml object at 0x7f47fabe2810>
 = False, kwargs = {'buffering': True}

    def getresponse(self, 
=False, **kwargs):
        """Retrieve the response"""
        # Check to see if the cassette has a response for this request. If so,
        # then return it
        if self.cassette.can_play_response_for(self.vcr_request):
            log.info(f"Playing response for {self.vcr_request} from cassette")
            response = self.cassette.play_response(self.vcr_request)
            return VCRHTTPResponse(response)
        else:
            if self.cassette.write_protected and self.cassette.filter_request(self.vcr_request):
>               raise CannotOverwriteExistingCassetteException(
                    cassette=self.cassette,
                    failed_request=self.vcr_request,
                )
E               vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_msi.yaml') in your current record mode ('once').
E               No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.12/site-packages/vcr/stubs/init.py:263: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.acs.tests.latest.test_aks_commands.AzureKubernetesServiceScenarioTest testMethod=test_aks_create_with_windows_msi>
resource_group = 'clitest000001', resource_group_location = 'westus2'

    @AllowLargeResponse()
    @AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2')
    def test_aks_create_with_windows_msi(self, resource_group, resource_group_location):
        # reset the count so in replay mode the random names will start with 0
        self.test_resources_count = 0
        # kwargs for string formatting
        aks_name = self.create_random_name('cliakstest', 16)
        self.kwargs.update({
            'resource_group': resource_group,
            'name': aks_name,
            'dns_name_prefix': self.create_random_name('cliaksdns', 16),
            'ssh_key_value': self.generate_ssh_keys(),
            'location': resource_group_location,
            'resource_type': 'Microsoft.ContainerService/ManagedClusters',
            'windows_admin_username': 'azureuser1',
            'windows_admin_password': 'replacePassword1234$',
            'nodepool2_name': 'npwin',
        })
    
        # create
        create_cmd = 'aks create --resource-group={resource_group} --name={name} --location={location} ' <br>                     '--dns-name-prefix={dns_name_prefix} --node-count=1 --ssh-key-value={ssh_key_value} ' <br>                     '--windows-admin-username={windows_admin_username} --windows-admin-password={windows_admin_password} ' <br>                     '--load-balancer-sku=standard --vm-set-type=virtualmachinescalesets --network-plugin=azure'
        self.cmd(create_cmd, checks=[
            self.exists('fqdn'),
            self.exists('nodeResourceGroup'),
            self.check('provisioningState', 'Succeeded'),
            self.check('windowsProfile.adminUsername', 'azureuser1')
        ])
    
        # nodepool add
        self.cmd('aks nodepool add --resource-group={resource_group} --cluster-name={name} --name={nodepool2_name} --os-type Windows --node-count=1', checks=[
            self.check('provisioningState', 'Succeeded')
        ])
    
        # update Windows license type
        self.cmd('aks update --resource-group={resource_group} --name={name} --enable-ahub', checks=[
            self.check('provisioningState', 'Succeeded'),
            self.check('windowsProfile.licenseType', 'Windows_Server')
        ])
    
        # #nodepool delete
>       self.cmd(
            'aks nodepool delete --resource-group={resource_group} --cluster-name={name} --name={nodepool2_name} --no-wait', checks=[self.is_empty()])

src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:5286: 
 
 
 
 
 
 
                                  
src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:251: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
 
                                       

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f47fab362d0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f47fd0351c0>
command = 'aks nodepool delete --resource-group=clitest000001 --cluster-name=cliakstest000001 --name=npwin --no-wait'
expect_failure = False

    def _in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
            self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
            self.output = stdout_buf.getvalue()
            self.applog = logging_buf.getvalue()
    
        except CannotOverwriteExistingCassetteException as ex:
>           raise AssertionError(ex)
E           AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_msi.yaml') in your current record mode ('once').
E           No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E           Matchers failed :
E           _custom_request_query_matcher - assertion failure :
E           None

src/azure-cli-testsdk/azure/cli/testsdk/base.py:307: AssertionError
azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:5242
Failed test_aks_nodepool_create_scale_delete_msi The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:4488
Failed test_aks_nodepool_system_pool_msi The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:4608
Failed test_aks_update_with_windows_gmsa The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:7969
Failed test_aks_update_with_windows_password The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:5714
❌3.9
Type Test Case Error Message Line
Failed test_aks_create_with_windows_gmsa self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fcacda31430>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fcad05e3e80>
command = 'aks nodepool delete --resource-group=clitest000001 --cluster-name=cliakstest000001 --name=npwin --no-wait'
expect_failure = False

    def in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0

src/azure-cli-testsdk/azure/cli/testsdk/base.py:302: 
                                        
env/lib/python3.9/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:129: in exception_handler
    return handle_exception(ex)
src/azure-cli-testsdk/azure/cli/testsdk/patches.py:33: in handle_main_exception
    raise ex
env/lib/python3.9/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:733: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:121: in handler
    return op(**command_args)
src/azure-cli/azure/cli/command_modules/acs/custom.py:2651: in aks_agentpool_delete
    return sdk_no_wait(
src/azure-cli-core/azure/cli/core/util.py:708: in sdk_no_wait
    return func(*args, **kwargs)
env/lib/python3.9/site-packages/azure/core/tracing/decorator.py:94: in wrapper_use_tracer
    return func(*args, **kwargs)
env/lib/python3.9/site-packages/azure/mgmt/containerservice/v2024_09_01/operations/agent_pools_operations.py:1088: in begin_delete
    raw_result = self.delete_initial(
env/lib/python3.9/site-packages/azure/mgmt/containerservice/v2024_09_01/operations/agent_pools_operations.py:1023: in delete_initial
    pipeline_response: PipelineResponse = self.client.pipeline.run(  # pylint: disable=protected-access
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:229: in run
    return first_node.send(pipeline_request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/mgmt/core/policies/base.py:47: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/redirect.py:197: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/retry.py:532: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/authentication.py:147: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:118: in send
    self.sender.send(request.http_request, **request.context.options),
env/lib/python3.9/site-packages/azure/core/pipeline/transport/requests_basic.py:355: in send
    response = self.session.request(  # type: ignore
env/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
env/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
env/lib/python3.9/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.9/site-packages/urllib3/connectionpool.py:715: in urlopen
    httplib_response = self.make_request(
env/lib/python3.9/site-packages/urllib3/connectionpool.py:458: in make_request
    httplib_response = conn.getresponse(buffering=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
          

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_gmsa.yaml object at 0x7fcacd96e3a0>
 = False, kwargs = {'buffering': True}

    def getresponse(self, 
=False, **kwargs):
        """Retrieve the response"""
        # Check to see if the cassette has a response for this request. If so,
        # then return it
        if self.cassette.can_play_response_for(self.vcr_request):
            log.info(f"Playing response for {self.vcr_request} from cassette")
            response = self.cassette.play_response(self.vcr_request)
            return VCRHTTPResponse(response)
        else:
            if self.cassette.write_protected and self.cassette.filter_request(self.vcr_request):
>               raise CannotOverwriteExistingCassetteException(
                    cassette=self.cassette,
                    failed_request=self.vcr_request,
                )
E               vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_gmsa.yaml') in your current record mode ('once').
E               No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.9/site-packages/vcr/stubs/init.py:263: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.acs.tests.latest.test_aks_commands.AzureKubernetesServiceScenarioTest testMethod=test_aks_create_with_windows_gmsa>
resource_group = 'clitest000001', resource_group_location = 'centraluseuap'

    @AllowLargeResponse()
    @AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='centraluseuap')
    def test_aks_create_with_windows_gmsa(self, resource_group, resource_group_location):
        # reset the count so in replay mode the random names will start with 0
        self.test_resources_count = 0
        # kwargs for string formatting
        aks_name = self.create_random_name('cliakstest', 16)
        self.kwargs.update({
            'resource_group': resource_group,
            'name': aks_name,
            'dns_name_prefix': self.create_random_name('cliaksdns', 16),
            'location': resource_group_location,
            'resource_type': 'Microsoft.ContainerService/ManagedClusters',
            'windows_admin_username': 'azureuser1',
            'windows_admin_password': 'replace-Password1234$',
            'nodepool2_name': 'npwin',
            'ssh_key_value': self.generate_ssh_keys()
        })
    
        # create
        create_cmd = 'aks create --resource-group={resource_group} --name={name} --location={location} ' <br>                     '--dns-name-prefix={dns_name_prefix} --node-count=1 ' <br>                     '--windows-admin-username={windows_admin_username} --windows-admin-password={windows_admin_password} ' <br>                     '--load-balancer-sku=standard --vm-set-type=virtualmachinescalesets --network-plugin=azure ' <br>                     '--ssh-key-value={ssh_key_value} --enable-windows-gmsa --yes ' <br>                     '--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AKSWindowsGmsaPreview'
        self.cmd(create_cmd, checks=[
            self.exists('fqdn'),
            self.exists('nodeResourceGroup'),
            self.check('provisioningState', 'Succeeded'),
            self.check('windowsProfile.adminUsername', 'azureuser1'),
            self.check('windowsProfile.gmsaProfile.enabled', 'True')
        ])
    
        # nodepool add
        self.cmd('aks nodepool add --resource-group={resource_group} --cluster-name={name} --name={nodepool2_name} --os-type Windows --node-count=1', checks=[
            self.check('provisioningState', 'Succeeded')
        ])
    
        # nodepool delete
>       self.cmd(
            'aks nodepool delete --resource-group={resource_group} --cluster-name={name} --name={nodepool2_name} --no-wait', checks=[self.is_empty()])

src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:7963: 
 
 
 
 
 
 
                                  
src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:251: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
 
                                       

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fcacda31430>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fcad05e3e80>
command = 'aks nodepool delete --resource-group=clitest000001 --cluster-name=cliakstest000001 --name=npwin --no-wait'
expect_failure = False

    def _in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
            self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
            self.output = stdout_buf.getvalue()
            self.applog = logging_buf.getvalue()
    
        except CannotOverwriteExistingCassetteException as ex:
>           raise AssertionError(ex)
E           AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_gmsa.yaml') in your current record mode ('once').
E           No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E           Matchers failed :
E           _custom_request_query_matcher - assertion failure :
E           None

src/azure-cli-testsdk/azure/cli/testsdk/base.py:307: AssertionError
azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:7922
Failed test_aks_create_with_windows_msi self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fcacd89d0d0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fcad05f8a00>
command = 'aks nodepool delete --resource-group=clitest000001 --cluster-name=cliakstest000001 --name=npwin --no-wait'
expect_failure = False

    def in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0

src/azure-cli-testsdk/azure/cli/testsdk/base.py:302: 
                                        
env/lib/python3.9/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:129: in exception_handler
    return handle_exception(ex)
src/azure-cli-testsdk/azure/cli/testsdk/patches.py:33: in handle_main_exception
    raise ex
env/lib/python3.9/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:733: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:121: in handler
    return op(**command_args)
src/azure-cli/azure/cli/command_modules/acs/custom.py:2651: in aks_agentpool_delete
    return sdk_no_wait(
src/azure-cli-core/azure/cli/core/util.py:708: in sdk_no_wait
    return func(*args, **kwargs)
env/lib/python3.9/site-packages/azure/core/tracing/decorator.py:94: in wrapper_use_tracer
    return func(*args, **kwargs)
env/lib/python3.9/site-packages/azure/mgmt/containerservice/v2024_09_01/operations/agent_pools_operations.py:1088: in begin_delete
    raw_result = self.delete_initial(
env/lib/python3.9/site-packages/azure/mgmt/containerservice/v2024_09_01/operations/agent_pools_operations.py:1023: in delete_initial
    pipeline_response: PipelineResponse = self.client.pipeline.run(  # pylint: disable=protected-access
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:229: in run
    return first_node.send(pipeline_request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/mgmt/core/policies/base.py:47: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/redirect.py:197: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/retry.py:532: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/authentication.py:147: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:118: in send
    self.sender.send(request.http_request, **request.context.options),
env/lib/python3.9/site-packages/azure/core/pipeline/transport/requests_basic.py:355: in send
    response = self.session.request(  # type: ignore
env/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
env/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
env/lib/python3.9/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.9/site-packages/urllib3/connectionpool.py:715: in urlopen
    httplib_response = self.make_request(
env/lib/python3.9/site-packages/urllib3/connectionpool.py:458: in make_request
    httplib_response = conn.getresponse(buffering=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
          

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_msi.yaml object at 0x7fcacd7e3ac0>
 = False, kwargs = {'buffering': True}

    def getresponse(self, 
=False, **kwargs):
        """Retrieve the response"""
        # Check to see if the cassette has a response for this request. If so,
        # then return it
        if self.cassette.can_play_response_for(self.vcr_request):
            log.info(f"Playing response for {self.vcr_request} from cassette")
            response = self.cassette.play_response(self.vcr_request)
            return VCRHTTPResponse(response)
        else:
            if self.cassette.write_protected and self.cassette.filter_request(self.vcr_request):
>               raise CannotOverwriteExistingCassetteException(
                    cassette=self.cassette,
                    failed_request=self.vcr_request,
                )
E               vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_msi.yaml') in your current record mode ('once').
E               No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.9/site-packages/vcr/stubs/init.py:263: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.acs.tests.latest.test_aks_commands.AzureKubernetesServiceScenarioTest testMethod=test_aks_create_with_windows_msi>
resource_group = 'clitest000001', resource_group_location = 'westus2'

    @AllowLargeResponse()
    @AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2')
    def test_aks_create_with_windows_msi(self, resource_group, resource_group_location):
        # reset the count so in replay mode the random names will start with 0
        self.test_resources_count = 0
        # kwargs for string formatting
        aks_name = self.create_random_name('cliakstest', 16)
        self.kwargs.update({
            'resource_group': resource_group,
            'name': aks_name,
            'dns_name_prefix': self.create_random_name('cliaksdns', 16),
            'ssh_key_value': self.generate_ssh_keys(),
            'location': resource_group_location,
            'resource_type': 'Microsoft.ContainerService/ManagedClusters',
            'windows_admin_username': 'azureuser1',
            'windows_admin_password': 'replacePassword1234$',
            'nodepool2_name': 'npwin',
        })
    
        # create
        create_cmd = 'aks create --resource-group={resource_group} --name={name} --location={location} ' <br>                     '--dns-name-prefix={dns_name_prefix} --node-count=1 --ssh-key-value={ssh_key_value} ' <br>                     '--windows-admin-username={windows_admin_username} --windows-admin-password={windows_admin_password} ' <br>                     '--load-balancer-sku=standard --vm-set-type=virtualmachinescalesets --network-plugin=azure'
        self.cmd(create_cmd, checks=[
            self.exists('fqdn'),
            self.exists('nodeResourceGroup'),
            self.check('provisioningState', 'Succeeded'),
            self.check('windowsProfile.adminUsername', 'azureuser1')
        ])
    
        # nodepool add
        self.cmd('aks nodepool add --resource-group={resource_group} --cluster-name={name} --name={nodepool2_name} --os-type Windows --node-count=1', checks=[
            self.check('provisioningState', 'Succeeded')
        ])
    
        # update Windows license type
        self.cmd('aks update --resource-group={resource_group} --name={name} --enable-ahub', checks=[
            self.check('provisioningState', 'Succeeded'),
            self.check('windowsProfile.licenseType', 'Windows_Server')
        ])
    
        # #nodepool delete
>       self.cmd(
            'aks nodepool delete --resource-group={resource_group} --cluster-name={name} --name={nodepool2_name} --no-wait', checks=[self.is_empty()])

src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:5286: 
 
 
 
 
 
 
                                  
src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:251: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
 
                                       

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fcacd89d0d0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fcad05f8a00>
command = 'aks nodepool delete --resource-group=clitest000001 --cluster-name=cliakstest000001 --name=npwin --no-wait'
expect_failure = False

    def _in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
            self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
            self.output = stdout_buf.getvalue()
            self.applog = logging_buf.getvalue()
    
        except CannotOverwriteExistingCassetteException as ex:
>           raise AssertionError(ex)
E           AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_windows_msi.yaml') in your current record mode ('once').
E           No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E           Matchers failed :
E           _custom_request_query_matcher - assertion failure :
E           None

src/azure-cli-testsdk/azure/cli/testsdk/base.py:307: AssertionError
azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:5242
Failed test_aks_nodepool_create_scale_delete_msi The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:4488
Failed test_aks_nodepool_system_pool_msi The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:4608
Failed test_aks_update_with_windows_gmsa The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:7969
Failed test_aks_update_with_windows_password The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acs/tests/latest/test_aks_commands.py:5714
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.9
️✔️ams
️✔️latest
️✔️3.12
️✔️3.9
️✔️apim
️✔️latest
️✔️3.12
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️aro
️✔️latest
️✔️3.12
️✔️3.9
️✔️backup
️✔️latest
️✔️3.12
️✔️3.9
️✔️batch
️✔️latest
️✔️3.12
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.9
️✔️billing
️✔️latest
️✔️3.12
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.9
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.9
️✔️config
️✔️latest
️✔️3.12
️✔️3.9
️✔️configure
️✔️latest
️✔️3.12
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.9
️✔️container
️✔️latest
️✔️3.12
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️dls
️✔️latest
️✔️3.12
️✔️3.9
️✔️dms
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.9
️✔️find
️✔️latest
️✔️3.12
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.9
️✔️identity
️✔️latest
️✔️3.12
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️lab
️✔️latest
️✔️3.12
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️maps
️✔️latest
️✔️3.12
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.9
️✔️profile
️✔️latest
️✔️3.12
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.9
️✔️redis
️✔️latest
️✔️3.12
️✔️3.9
️✔️relay
️✔️latest
️✔️3.12
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️role
️✔️latest
️✔️3.12
️✔️3.9
️✔️search
️✔️latest
️✔️3.12
️✔️3.9
️✔️security
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.9
️✔️sql
️✔️latest
️✔️3.12
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️util
️✔️latest
️✔️3.12
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9

Copy link

Hi @tonychen15,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

Copy link

azure-client-tools-bot-prd bot commented Oct 25, 2024

⚠️AzureCLI-BreakingChangeTest
⚠️acs
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd aks nodepool delete cmd aks nodepool delete added parameter ignore_pod_disruption_budget

@yonzhan
Copy link
Collaborator

yonzhan commented Oct 25, 2024

Thank you for your contribution! We will review the pull request and get back to you soon.

@tonychen15 tonychen15 changed the title Add ignore-PDB flag to aks nodepool delete command AKS Adds ignore-PDB flag to aks nodepool delete command Oct 25, 2024
@tonychen15 tonychen15 changed the title AKS Adds ignore-PDB flag to aks nodepool delete command [AKS] Adds ignore-PDB flag to aks nodepool delete command Oct 25, 2024
@tonychen15 tonychen15 changed the title [AKS] Adds ignore-PDB flag to aks nodepool delete command [AKS] Adds ignore-pod-disruption-budget flag to aks nodepool delete command Oct 26, 2024
Copy link
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

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

Queued live test to validate the change.

Comment on lines 1507 to 1519
def get_ignore_pod_disruption_budget(self) -> bool:
return self._get_ignore_pod_disruption_budget()

def _get_ignore_pod_disruption_budget(self) -> bool:
"""Obtain the value of ignore_pod_disruption_budget, default value is False.

:return: bool
"""
# read the original value passed by the command
ignore_pod_disruption_budget = self.raw_param.get("ignore_pod_disruption_budget", False)

# This parameter does not need dynamic completion.
return ignore_pod_disruption_budget
Copy link
Member

Choose a reason for hiding this comment

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

I think you don't need this as this is not an option for az aks nodepool add/update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I overlooked your comment in the code. Removed.

Comment on lines 1497 to 1508
def common_get_ignore_pod_disruption_budget(self):
ctx_1 = AKSAgentPoolContext(
self.cmd,
AKSAgentPoolParamDict({
"ignore_pod_disruption_budget": True,
}),
self.models,
DecoratorMode.DELETE,
self.agentpool_decorator_mode,
)
self.assertEqual(ctx_1.get_ignore_pod_disruption_budget(), True)

Copy link
Member

Choose a reason for hiding this comment

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

And there's no need for the test here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, thanks.

with self.argument_context("aks nodepool delete") as c:
c.argument(
"ignore_pod_disruption_budget",
options_list=["--ignore-pod-disruption-budget"],
Copy link
Member

Choose a reason for hiding this comment

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

If the only option form is --ignore-pod-disruption-budget, you could ignore this line. In cli-extensions/aks-preview, it has another shorthand option name -i, do you want to keep it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. I intentionally remove that to make sure CX fully understand what they're doing.

Copy link
Contributor Author

@tonychen15 tonychen15 Oct 28, 2024

Choose a reason for hiding this comment

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

Need to add ignore-pdb as ignore-pod-disruption-budget exceeds the maximum length 22.

@tonychen15 tonychen15 force-pushed the dev-ipdb branch 3 times, most recently from dc906f7 to e48de17 Compare October 28, 2024 19:16
@tonychen15
Copy link
Contributor Author

It seems both Python39 and Python312 failed at test case aks_agentpool_create_scale_delete with version 2020-09-01 (https://dev.azure.com/azclitools/public/_build/results?buildId=201476&view=logs&j=4e4d232d-230a-55c9-0730-4c1a9c36b9e5&t=6d1bdb99-245b-5117-da18-01d8df6f72c0&l=1356). Is this failed test case a known issue?

with self.argument_context("aks nodepool delete") as c:
c.argument(
"ignore_pod_disruption_budget",
options_list=["--ignore-pdb"],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
options_list=["--ignore-pdb"],
options_list=["--ignore-pdb", "--ignore-pod-disruption-budget"],

please also include the default option name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added back, hope that pylint not to report length too long error.

@FumingZhang
Copy link
Member

Requeued live test.

The following cases failed in replay mode as you've changed the behavior of az aks nodepool delete.

  • test_aks_create_with_windows_gmsa
  • test_aks_create_with_windows_msi
  • test_aks_nodepool_create_scale_delete_msi
  • test_aks_nodepool_delete_with_ignore_pod_disruption_budget
  • test_aks_nodepool_system_pool_msi
  • test_aks_update_with_windows_gmsa
  • test_aks_update_with_windows_password

There's a PR #30290 that bumped the default API version merged earlier today. Please rebase from dev branch, requeue the tests and them commit the updated recording files.

@@ -1614,6 +1614,14 @@
helps['aks nodepool delete'] = """
type: command
short-summary: Delete the agent pool in the managed Kubernetes cluster.
parameters:
- name: --ignore-pdb
Copy link
Member

Choose a reason for hiding this comment

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

  • FAIL - HIGH severity: unrecognized_help_parameter_rule
    Help-Entry: aks nodepool delete - The following parameter help names are invalid: --ignore-pdb

Try the following, one of them would be correct

Suggested change
- name: --ignore-pdb
- name: --ignore-pdb --ignore-pod-disruption-budget
Suggested change
- name: --ignore-pdb
- name: --ignore-pod-disruption-budget --ignore-pdb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

Comment on lines +2608 to +2609
active_cloud = get_active_cloud(cmd.cli_ctx)
if active_cloud.profile != "latest":
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this logic also be used in old profiles env such as Azure Stack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this feature is only used in AKS. @zhoxing-ms

@tonychen15
Copy link
Contributor Author

@FumingZhang and @zhoxing-ms I have rebased to the latest dev branch, and updated per your comments, somehow that full test is still failed. As ignore-pdb is not a required parameter to "az aks nodepool delete", so it should not have the impact to other aks cli command. I'm quite confused about why those aks tests failed for it.

Any more suggestions on this? Thanks.

@FumingZhang
Copy link
Member

Failures in Automation Full Test XXX are not related to your changes, I think the corresponding team is working on the fix. As for failures in linter, may try the other way https://github.com/Azure/azure-cli/pull/30196/files#r1837556755

  • FAIL - HIGH severity: unrecognized_help_parameter_rule
    Help-Entry: aks nodepool delete - The following parameter help names are invalid: --ignore-pod-disruption-budget --ignore-pdb

@tonychen15
Copy link
Contributor Author

Failures in Automation Full Test XXX are not related to your changes, I think the corresponding team is working on the fix. As for failures in linter, may try the other way https://github.com/Azure/azure-cli/pull/30196/files#r1837556755

  • FAIL - HIGH severity: unrecognized_help_parameter_rule
    Help-Entry: aks nodepool delete - The following parameter help names are invalid: --ignore-pod-disruption-budget --ignore-pdb

So, we will wait for another team's fix, then merge this PR? If so, I will retest it later.

@tonychen15
Copy link
Contributor Author

Failures in Automation Full Test XXX are not related to your changes, I think the corresponding team is working on the fix. As for failures in linter, may try the other way https://github.com/Azure/azure-cli/pull/30196/files#r1837556755

  • FAIL - HIGH severity: unrecognized_help_parameter_rule
    Help-Entry: aks nodepool delete - The following parameter help names are invalid: --ignore-pod-disruption-budget --ignore-pdb

So, we will wait for another team's fix, then merge this PR? If so, I will retest it later.

@FumingZhang @zhoxing-ms any way we can move this PR forward?

@FumingZhang
Copy link
Member

@tonychen15 please fix the failed CI check.

Take Azure.azure-cli Full Test (Automation Full Test Python312 Profile Latest instance6) as an example, the following cases failed

FAILED src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py::AzureKubernetesServiceScenarioTest::test_aks_create_with_windows_gmsa
FAILED src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py::AzureKubernetesServiceScenarioTest::test_aks_create_with_windows_msi
FAILED src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py::AzureKubernetesServiceScenarioTest::test_aks_nodepool_create_scale_delete_msi
FAILED src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py::AzureKubernetesServiceScenarioTest::test_aks_nodepool_system_pool_msi
FAILED src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py::AzureKubernetesServiceScenarioTest::test_aks_update_with_windows_gmsa
FAILED src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py::AzureKubernetesServiceScenarioTest::test_aks_update_with_windows_password

and the error is

      raise AssertionError(ex)

E AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_update_with_windows_password.yaml') in your current record mode ('once').
E No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01&ignore-pod-disruption-budget=false>) was found.
E Found 1 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001/agentPools/npwin?api-version=2024-09-01>)..)
E Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E Matchers failed :
E _custom_request_query_matcher - assertion failure :
E None

As I've mentioned

Requeued live test.

The following cases failed in replay mode as you've changed the behavior of az aks nodepool delete.

  • test_aks_create_with_windows_gmsa
  • test_aks_create_with_windows_msi
  • test_aks_nodepool_create_scale_delete_msi
  • test_aks_nodepool_delete_with_ignore_pod_disruption_budget
  • test_aks_nodepool_system_pool_msi
  • test_aks_update_with_windows_gmsa
  • test_aks_update_with_windows_password

There's a PR #30290 that bumped the default API version merged earlier today. Please rebase from dev branch, requeue the tests and them commit the updated recording files.

I just requeued the live test for you. Please commit the updated recording files once those tests passed.

@tonychen15
Copy link
Contributor Author

I see. I need to manually rerun those failed test cases locally and upload their logs. I thought the pipeline may rerun them on the server side.
test_aks_create_with_windows_gmsa
test_aks_create_with_windows_msi
test_aks_nodepool_create_scale_delete_msi
test_aks_nodepool_delete_with_ignore_pod_disruption_budget
test_aks_nodepool_system_pool_msi
test_aks_update_with_windows_gmsa
test_aks_update_with_windows_password

@FumingZhang
Copy link
Member

I noticed that you did not upload the new recording files corresponding to the above-mentioned test cases. The live test I queued passed, and you could find them from pipeline artifacts.

Screenshot 2024-12-03 144445

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AKS az aks/acs/openshift Auto-Assign Auto assign by bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants