azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

`test_containerapp_custom_domains_app_in_different_rg` live test fails: A TXT record pointing from asuid.devtest.containerappr7yejddv4asf.com to 2530... was not found.

Open jiasli opened this issue 1 year ago • 4 comments

https://dev.azure.com/azclitools/internal/_build/results?buildId=145445&view=logs&j=a68aad0c-a8ca-5efb-13dd-553b7e4852b6&t=a1b82c51-4e69-5284-d654-f14c8600adaf

2024-04-02T09:41:13.0703666Z _ ContainerappIngressTests.test_containerapp_custom_domains_app_in_different_rg _
2024-04-02T09:41:13.0704550Z [gw0] linux -- Python 3.10.14 /mnt/vss/_work/1/s/env/bin/python
2024-04-02T09:41:13.0704995Z self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fa63d582650>
2024-04-02T09:41:13.0705691Z cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fa648566440>
2024-04-02T09:41:13.0706660Z command = 'containerapp ssl upload -n containerappr7yejddv4asf -g app-rgycz7xcilwlz33wes2r --environment /subscriptions/0b1f6471...e-cli/azure/cli/command_modules/containerapp/tests/latest/data/cert.pfx" --password test12 -c cert-pfxkl6fokns3u3pfbiv'
2024-04-02T09:41:13.0707311Z expect_failure = False
2024-04-02T09:41:13.0707540Z 
2024-04-02T09:41:13.0707983Z     def _in_process_execute(self, cli_ctx, command, expect_failure=False):
2024-04-02T09:41:13.0708429Z         from io import StringIO
2024-04-02T09:41:13.0708814Z         from vcr.errors import CannotOverwriteExistingCassetteException
2024-04-02T09:41:13.0709195Z     
2024-04-02T09:41:13.0709683Z         if command.startswith('az '):
2024-04-02T09:41:13.0710099Z             command = command[3:]
2024-04-02T09:41:13.0710413Z     
2024-04-02T09:41:13.0710704Z         stdout_buf = StringIO()
2024-04-02T09:41:13.0711027Z         logging_buf = StringIO()
2024-04-02T09:41:13.0711350Z         try:
2024-04-02T09:41:13.0711745Z             # issue: stderr cannot be redirect in this form, as a result some failure information
2024-04-02T09:41:13.0712145Z             # is lost when command fails.
2024-04-02T09:41:13.0712574Z >           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
2024-04-02T09:41:13.0712872Z 
2024-04-02T09:41:13.0713432Z src/azure-cli-testsdk/azure/cli/testsdk/base.py:302: 
2024-04-02T09:41:13.0713902Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2024-04-02T09:41:13.0714489Z env/lib/python3.10/site-packages/knack/cli.py:245: in invoke
2024-04-02T09:41:13.0714944Z     exit_code = self.exception_handler(ex)
2024-04-02T09:41:13.0715522Z src/azure-cli-core/azure/cli/core/__init__.py:127: in exception_handler
2024-04-02T09:41:13.0715965Z     return handle_exception(ex)
2024-04-02T09:41:13.0716307Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2024-04-02T09:41:13.0716510Z 
2024-04-02T09:41:13.0717181Z ex = ValidationError('A TXT record pointing from asuid.devtest.containerappr7yejddv4asf.com to 253001F2FCF5A7B1CD759EB861E9BB1596370BE27E47A991F72184277B3D12F2 was not found.')
2024-04-02T09:41:13.0717662Z args = (), kwargs = {}
2024-04-02T09:41:13.0717841Z 
2024-04-02T09:41:13.0718300Z     def _handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
2024-04-02T09:41:13.0718701Z         if isinstance(ex, CannotOverwriteExistingCassetteException):
2024-04-02T09:41:13.0719099Z             # This exception usually caused by a no match HTTP request. This is a product error
2024-04-02T09:41:13.0719472Z             # that is caused by change of SDK invocation.
2024-04-02T09:41:13.0719766Z             raise ex
2024-04-02T09:41:13.0720028Z     
2024-04-02T09:41:13.0720292Z >       raise CliExecutionError(ex)
2024-04-02T09:41:13.0720685Z E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception ValidationError during execution and fails the command.
2024-04-02T09:41:13.0720968Z 
2024-04-02T09:41:13.0721411Z src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError
2024-04-02T09:41:13.0721633Z 
2024-04-02T09:41:13.0721953Z During handling of the above exception, another exception occurred:
2024-04-02T09:41:13.0722166Z 
2024-04-02T09:41:13.0722584Z self = <azure.cli.command_modules.containerapp.tests.latest.test_containerapp_commands.ContainerappIngressTests testMethod=test_containerapp_custom_domains_app_in_different_rg>
2024-04-02T09:41:13.0723497Z resource_group = 'clitest.rg7ak7pwxkptpl3g4hcgl2vnkb2pm5decqvpd5f2qojn7mdnrnkwzdredl6q4robuml'
2024-04-02T09:41:13.0724022Z laworkspace_customer_id = '567985b1-882b-4f02-9ac8-07b802d186e8'
2024-04-02T09:41:13.0724628Z laworkspace_shared_key = 'dRab31Bft2L86jdxqVzfEaCr4Vug7AEHkcSjVE8oe+nckYQOFLJ569Ba+pBdph9oVsoofdCR3K2+GbV454yvjw=='
2024-04-02T09:41:13.0725049Z 
2024-04-02T09:41:13.0725328Z     @AllowLargeResponse(8192)
2024-04-02T09:41:13.0725650Z     @ResourceGroupPreparer(location="westeurope")
2024-04-02T09:41:13.0726106Z     @LogAnalyticsWorkspacePreparer(location="eastus", get_shared_key=True)
2024-04-02T09:41:13.0726567Z     def test_containerapp_custom_domains_app_in_different_rg(self, resource_group, laworkspace_customer_id, laworkspace_shared_key):
2024-04-02T09:41:13.0727131Z         self.cmd('configure --defaults location={}'.format(TEST_LOCATION))
2024-04-02T09:41:13.0727458Z     
2024-04-02T09:41:13.0728300Z         env_name = self.create_random_name(prefix='containerapp-env', length=24)
2024-04-02T09:41:13.0729850Z         ca_name = self.create_random_name(prefix='containerapp', length=24)
2024-04-02T09:41:13.0730252Z         app_rg_name = self.create_random_name(prefix='app-rg', length=24)
2024-04-02T09:41:13.0730643Z         create_containerapp_env(self, env_name, resource_group, logs_workspace=laworkspace_customer_id, logs_workspace_shared_key=laworkspace_shared_key)
2024-04-02T09:41:13.0731083Z         self.cmd(f'group create -n {app_rg_name}')
2024-04-02T09:41:13.0731543Z         env_id = self.cmd('containerapp env show -n {} -g {}'.format(env_name, resource_group)).get_output_in_json()["id"]
2024-04-02T09:41:13.0731813Z     
2024-04-02T09:41:13.0732293Z         app = self.cmd('containerapp create -g {} -n {} --environment {} --ingress external --target-port 80'.format(app_rg_name, ca_name, env_id)).get_output_in_json()
2024-04-02T09:41:13.0732578Z     
2024-04-02T09:41:13.0732931Z         self.cmd('containerapp hostname list -g {} -n {}'.format(app_rg_name, ca_name), checks=[
2024-04-02T09:41:13.0733269Z             JMESPathCheck('length(@)', 0),
2024-04-02T09:41:13.0733460Z         ])
2024-04-02T09:41:13.0733618Z     
2024-04-02T09:41:13.0733811Z         # list hostnames with a wrong location
2024-04-02T09:41:13.0734216Z         self.cmd('containerapp hostname list -g {} -n {} -l "{}"'.format(app_rg_name, ca_name, "eastus2"), checks={
2024-04-02T09:41:13.0734567Z             JMESPathCheck('length(@)', 0),
2024-04-02T09:41:13.0734769Z         }, expect_failure=True)
2024-04-02T09:41:13.0734948Z     
2024-04-02T09:41:13.0735141Z         # create an App service domain and update its txt records
2024-04-02T09:41:13.0735495Z         contacts = os.path.join(TEST_DIR, 'data', 'domain-contact.json')
2024-04-02T09:41:13.0735733Z         zone_name = "{}.com".format(ca_name)
2024-04-02T09:41:13.0735929Z         subdomain_1 = "devtest"
2024-04-02T09:41:13.0736118Z         subdomain_2 = "clitest"
2024-04-02T09:41:13.0736321Z         txt_name_1 = "asuid.{}".format(subdomain_1)
2024-04-02T09:41:13.0736543Z         txt_name_2 = "asuid.{}".format(subdomain_2)
2024-04-02T09:41:13.0736774Z         hostname_1 = "{}.{}".format(subdomain_1, zone_name)
2024-04-02T09:41:13.0737006Z         hostname_2 = "{}.{}".format(subdomain_2, zone_name)
2024-04-02T09:41:13.0737263Z         verification_id = app["properties"]["customDomainVerificationId"]
2024-04-02T09:41:13.0737809Z         self.cmd("appservice domain create -g {} --hostname {} --contact-info=@'{}' --accept-terms".format(resource_group, zone_name, contacts)).get_output_in_json()
2024-04-02T09:41:13.0738420Z         self.cmd('network dns record-set txt add-record -g {} -z {} -n {} -v {}'.format(resource_group, zone_name, txt_name_1, verification_id)).get_output_in_json()
2024-04-02T09:41:13.0739006Z         self.cmd('network dns record-set txt add-record -g {} -z {} -n {} -v {}'.format(resource_group, zone_name, txt_name_2, verification_id)).get_output_in_json()
2024-04-02T09:41:13.0739280Z     
2024-04-02T09:41:13.0739462Z         # upload cert, add hostname & binding
2024-04-02T09:41:13.0739781Z         pfx_file = os.path.join(TEST_DIR, 'data', 'cert.pfx')
2024-04-02T09:41:13.0740071Z         testpassword = 'test12'
2024-04-02T09:41:13.0740407Z         cert_pfx_name = self.create_random_name(prefix='cert-pfx', length=24)
2024-04-02T09:41:13.0741164Z >       cert_id = self.cmd('containerapp ssl upload -n {} -g {} --environment {} --hostname {} --certificate-file "{}" --password {} -c {}'.format(ca_name, app_rg_name, env_id, hostname_1, pfx_file, testpassword, cert_pfx_name), checks=[
2024-04-02T09:41:13.0741744Z             JMESPathCheck('[0].name', hostname_1),
2024-04-02T09:41:13.0741982Z         ]).get_output_in_json()[0]["certificateId"]
2024-04-02T09:41:13.0742077Z 
2024-04-02T09:41:13.0742454Z src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_commands.py:283: 
2024-04-02T09:41:13.0742754Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2024-04-02T09:41:13.0743097Z src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: in cmd
2024-04-02T09:41:13.0743388Z     return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
2024-04-02T09:41:13.0743772Z src/azure-cli-testsdk/azure/cli/testsdk/base.py:251: in __init__
2024-04-02T09:41:13.0744049Z     self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
2024-04-02T09:41:13.0744447Z src/azure-cli-testsdk/azure/cli/testsdk/base.py:314: in _in_process_execute
2024-04-02T09:41:13.0744698Z     raise ex.exception
2024-04-02T09:41:13.0745023Z env/lib/python3.10/site-packages/knack/cli.py:233: in invoke
2024-04-02T09:41:13.0745272Z     cmd_result = self.invocation.execute(args)
2024-04-02T09:41:13.0745627Z src/azure-cli-core/azure/cli/core/commands/__init__.py:664: in execute
2024-04-02T09:41:13.0745850Z     raise ex
2024-04-02T09:41:13.0746180Z src/azure-cli-core/azure/cli/core/commands/__init__.py:731: in _run_jobs_serially
2024-04-02T09:41:13.0746454Z     results.append(self._run_job(expanded_arg, cmd_copy))
2024-04-02T09:41:13.0746809Z src/azure-cli-core/azure/cli/core/commands/__init__.py:723: in _run_job
2024-04-02T09:41:13.0747059Z     return cmd_copy.exception_handler(ex)
2024-04-02T09:41:13.0747462Z src/azure-cli/azure/cli/command_modules/containerapp/_client_factory.py:28: in _polish_bad_errors
2024-04-02T09:41:13.0747714Z     raise ex
2024-04-02T09:41:13.0748042Z src/azure-cli-core/azure/cli/core/commands/__init__.py:701: in _run_job
2024-04-02T09:41:13.0748288Z     result = cmd_copy(params)
2024-04-02T09:41:13.0748623Z src/azure-cli-core/azure/cli/core/commands/__init__.py:334: in __call__
2024-04-02T09:41:13.0748866Z     return self.handler(*args, **kwargs)
2024-04-02T09:41:13.0749228Z src/azure-cli-core/azure/cli/core/commands/command_operation.py:121: in handler
2024-04-02T09:41:13.0749474Z     return op(**command_args)
2024-04-02T09:41:13.0749696Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2024-04-02T09:41:13.0749813Z 
2024-04-02T09:41:13.0750025Z cmd = <azure.cli.core.commands.AzCliCommand object at 0x7fa63d4e8460>
2024-04-02T09:41:13.0750371Z resource_group_name = 'app-rgycz7xcilwlz33wes2r'
2024-04-02T09:41:13.0750662Z name = 'containerappr7yejddv4asf'
2024-04-02T09:41:13.0751312Z environment = '/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/clitest.rg7ak7pwxkptpl3g4hcgl2vnkb2pm5decqvpd5f2qojn7mdnrnkwzdredl6q4robuml/providers/Microsoft.App/managedEnvironments/containerapp-envfkuzic64'
2024-04-02T09:41:13.0751926Z certificate_file = '/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/data/cert.pfx'
2024-04-02T09:41:13.0752310Z hostname = 'devtest.containerappr7yejddv4asf.com'
2024-04-02T09:41:13.0752686Z certificate_password = 'test12', certificate_name = 'cert-pfxkl6fokns3u3pfbiv'
2024-04-02T09:41:13.0752974Z location = 'eastus'
2024-04-02T09:41:13.0753050Z 
2024-04-02T09:41:13.0753335Z     def upload_ssl(cmd, resource_group_name, name, environment, certificate_file, hostname, certificate_password=None, certificate_name=None, location=None):
2024-04-02T09:41:13.0753681Z         _validate_subscription_registered(cmd, CONTAINER_APPS_RP)
2024-04-02T09:41:13.0753889Z     
2024-04-02T09:41:13.0754112Z         passed, message = validate_hostname(cmd, resource_group_name, name, hostname)
2024-04-02T09:41:13.0754451Z         if not passed:
2024-04-02T09:41:13.0754854Z >           raise ValidationError(message or 'Please configure the DNS records before adding the hostname.')
2024-04-02T09:41:13.0755359Z E           azure.cli.core.azclierror.ValidationError: A TXT record pointing from asuid.devtest.containerappr7yejddv4asf.com to 253001F2FCF5A7B1CD759EB861E9BB1596370BE27E47A991F72184277B3D12F2 was not found.
2024-04-02T09:41:13.0755605Z 
2024-04-02T09:41:13.0755950Z src/azure-cli/azure/cli/command_modules/containerapp/custom.py:3823: ValidationError
2024-04-02T09:41:13.0756358Z ----------------------------- Captured stderr call -----------------------------
2024-04-02T09:41:13.0756486Z 
2024-04-02T09:41:13.0756646Z / Running ..
2024-04-02T09:41:13.0756815Z | Running ..
2024-04-02T09:41:13.0756983Z \ Running ..
2024-04-02T09:41:13.0757207Z - Running ..
2024-04-02T09:41:13.0757376Z / Running ..
2024-04-02T09:41:13.0757542Z | Running ..
2024-04-02T09:41:13.0757709Z \ Running ..
2024-04-02T09:41:13.0757933Z - Running ..
2024-04-02T09:41:13.0758103Z / Running ..
2024-04-02T09:41:13.0758261Z | Running ..
2024-04-02T09:41:13.0758422Z \ Running ..
2024-04-02T09:41:13.0758634Z - Running ..
2024-04-02T09:41:13.0758802Z / Running ..
2024-04-02T09:41:13.0758969Z | Running ..
2024-04-02T09:41:13.0759136Z \ Running ..
2024-04-02T09:41:13.0759356Z - Running ..
2024-04-02T09:41:13.0759524Z / Running ..
2024-04-02T09:41:13.0759686Z | Running ..
2024-04-02T09:41:13.0759846Z \ Running ..
2024-04-02T09:41:13.0760070Z - Running ..
2024-04-02T09:41:13.0760234Z / Running ..
2024-04-02T09:41:13.0760390Z | Running ..
2024-04-02T09:41:13.0760557Z \ Running ..
2024-04-02T09:41:13.0760769Z - Running ..
2024-04-02T09:41:13.0760934Z / Running ..
2024-04-02T09:41:13.0761099Z | Running ..
2024-04-02T09:41:13.0761256Z \ Running ..
2024-04-02T09:41:13.0761458Z - Running ..
2024-04-02T09:41:13.0761623Z / Running ..
2024-04-02T09:41:13.0761789Z | Running ..
2024-04-02T09:41:13.0761951Z \ Running ..
2024-04-02T09:41:13.0762162Z - Running ..
2024-04-02T09:41:13.0762333Z / Running ..
2024-04-02T09:41:13.0762499Z | Running ..
2024-04-02T09:41:13.0762887Z \ Running ..
2024-04-02T09:41:13.0763147Z - Running ..
2024-04-02T09:41:13.0763332Z / Running ..
2024-04-02T09:41:13.0763504Z | Running ..
2024-04-02T09:41:13.0763670Z \ Running ..
2024-04-02T09:41:13.0763888Z - Running ..
2024-04-02T09:41:13.0764060Z / Running ..
2024-04-02T09:41:13.0764217Z | Running ..
2024-04-02T09:41:13.0764385Z \ Running ..
2024-04-02T09:41:13.0764593Z - Running ..
2024-04-02T09:41:13.0764792Z [K
2024-04-02T09:41:13.0764947Z / Running ..
2024-04-02T09:41:13.0765114Z | Running ..
2024-04-02T09:41:13.0765281Z \ Running ..
2024-04-02T09:41:13.0765511Z - Running ..
2024-04-02T09:41:13.0765985Z [KWARNING: Command group 'appservice domain' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
2024-04-02T09:41:13.0766451Z ------------------------------ Captured log call -------------------------------
2024-04-02T09:41:13.0766826Z WARNING  cli.azure.cli.command_modules.containerapp.containerapp_env_decorator:containerapp_env_decorator.py:162 
2024-04-02T09:41:13.0767345Z Container Apps environment created. To deploy a container app, use: az containerapp create --help
2024-04-02T09:41:13.0767493Z 
2024-04-02T09:41:13.0767776Z WARNING  cli.azure.cli.command_modules.containerapp.containerapp_decorator:containerapp_decorator.py:513 
2024-04-02T09:41:13.0768329Z Container app created. Access your app at https://containerappr7yejddv4asf.blackrock-9df57ab1.eastus.azurecontainerapps.io/

jiasli avatar Apr 02 '24 12:04 jiasli

Thank you for opening this issue, we will look into it.

yonzhan avatar Apr 02 '24 12:04 yonzhan

@Greedygre Could you please help take a look at the containerapp related test issue?

zhoxing-ms avatar Apr 03 '24 02:04 zhoxing-ms

Hi TXT record pointing from asuid.devtest.containerappr7yejddv4asf.com to 253001F2FCF5A7B1CD759EB861E9BB1596370BE27E47A991F72184277B3D12F2 was not found.

This error is due to the domain in not created successfully, in the previous command to create domain and bind TXT record, it didn't check the result of following commands:

        self.cmd("appservice domain create -g {} --hostname {} --contact-info=@'{}' --accept-terms".format(resource_group, zone_name, contacts)).get_output_in_json()
        self.cmd('network dns record-set txt add-record -g {} -z {} -n {} -v {}'.format(resource_group, zone_name, txt_name_1, verification_id)).get_output_in_json()
        self.cmd('network dns record-set txt add-record -g {} -z {} -n {} -v {}'.format(resource_group, zone_name, txt_name_2, verification_id)).get_output_in_json()

Greedygre avatar Apr 17 '24 06:04 Greedygre

I temporarily skipped this test in #28660. @Greedygre, please refine this test and make it stable when you have time.

jiasli avatar May 08 '24 02:05 jiasli