Repository navigation
Azure CLI connection timeout when running a long test using the ScenarioTest framework #26983
Description
Activity
- addedbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.
on Jul 24, 2023 azure-client-tools-bot-prd commented
on Jul 24, 2023 More actions2.48.1 is not the latest Azure CLI(2.50.0).
Please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.
- ghost addedGraph(doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad(doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad
on Jul 24, 2023 Thank you for opening this issue, we will look into it.
Hi patrykkulik-microsoft,
I don't think we put a timeout limit on tests, like this one running for more than an hour.

How long will your test run?
Can your test be split into multiple smaller tests?
Is there a PR for me to debug?patrykkulik-microsoft commented
on Aug 14, 2023 AuthorMore actionsZelinWang (@wangzelin007) thank you for your reply.
The limit that that I am hitting is not on the test scope but on the
self.cmdscope. One command is running for about 10 minutes and then I hit the error which I pasted above.The test itself runs for about 20min but as I said the test is not the problem and the command cannot be split into smaller commands.
We have a PR set to the
azure-cli-extensionsrepo: Azure/azure-cli-extensions#6426The problematic test is
src/aosm/azext_aosm/tests/latest/test_aosm_vnf_publish_and_delete.py,
Note: in that PR, this test has been commented out and I have added a while loop to try the command twice which makes it pass so you will need to remove the while loop to see the error. I would be happy to connect with you to help you reproduce this error.If one http request needs to take so long as >10 min, why don't you return a poller for continuously querying status? The timeout limit comes from
azure-corewhich is adopted by all clients, not only clipatrykkulik-microsoft commented
on Aug 15, 2023 AuthorMore actionsIt is not a single http request that needs 10minutes. I am running a self.cmd() method of the ScenarioTest class. I am using this method to run a command from our CLI extension which publishes multiple resources in Azure. This commands runs multiple HTTP requests. None of these individually take longer than 10mins but all of them together do.
I am hitting an error during the runtime of this command with multiple HTTP requests, which seems to happen because the CLI command as a whole takes too long rather than any individual request. In fact, if I run the command twice, the second time in runs, some resources have already been published by it in the first run before the error happened so the second run takes less time and passes fine.
Describe the bug
My team is in the process of creating a new Azure CLI extension. As part of creating this extension, we wanted to add integration tests which would test our new commands. According to this document: https://github.com/Azure/azure-cli/blob/dev/doc/authoring_tests.md in the azure-cli repository, I should be able to author integration tests by taking advantage of the ScenarioTest class.
When I run
azdev test aosmthe publish command in our extension manages to deploy a few resources but fails after a few minutes with the error attached below.Interestingly, if I reduce the number of deployments that need to be done by this command, the command manages to reach completion. This (and the error) suggest to me that the testing framework implements some sort of timeout which I cannot modify and which does not allow my command to complete running and succeed. Is this correct? Is there anything I can do to remove this timeout condition?
Related command
azdev test aosmErrors
Issue script & Debug output
no different than the above error message
Expected behavior
I expect the test to pass.
Environment Summary
azure-cli 2.48.1 *
core 2.48.1 *
telemetry 1.0.8
Extensions:
connectedk8s 1.3.5
customlocation 0.1.3
k8s-extension 1.3.6
resource-graph 2.1.0
aosm 0.1.0 (dev) /home/developer/Projects/azure-cli-extensions/src/aosm
Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
Python location '/home/developer/.virtualenvs/az-cli-env/bin/python'
Extensions directory '/home/developer/.azure/cliextensions'
Development extension sources:
/home/developer/Projects/azure-cli-extensions
Python (Linux) 3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Additional context
No response