-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
{testsdk} Copy command index to random config dir #28853
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
# In recording mode, copy login credentials from global config dir to the dummy config dir | ||
if os.getenv(ENV_VAR_TEST_LIVE, '').lower() == 'true': | ||
if os.path.exists(GLOBAL_CONFIG_DIR): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if GLOBAL_CONFIG_DIR
doesn't exist, no error will occur as FileNotFoundError
is ignored.
'service_principal_entries.bin', 'service_principal_entries.json' | ||
]) | ||
|
||
ensure_dir(config_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure_dir(config_dir)
will be called anyway later in azure.cli.core.AzCli.__init__
:
ensure_dir(azure_folder) |
We can unconditionally do it here to make the code neat.
As config_dir
is a sub-folder in GLOBAL_CONFIG_DIR
, ensure_dir
will also create GLOBAL_CONFIG_DIR
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need support
Temporally bypass #28848
Final fix should be done by #28849
Description
Running
test_containerapp_manualjob_withsecret_crudoperations_e2e
andtest_hdinsight_application
sequentially fails withAs explained in #28848 (comment), even after
test_containerapp_manualjob_withsecret_crudoperations_e2e
finishes and deletes the random config dir,test_hdinsight_application
still tries to initialize command index in the same random config dir, because of the polluted env varAZURE_CONFIG_DIR
(#28849 (comment)).This PR copies command index to random config dir first so that it can be loaded during
azure.cli.core.AzCli.__init__
:azure-cli/src/azure-cli-core/azure/cli/core/__init__.py
Line 82 in f98ba80
which is called during
azure.cli.testsdk.base.ScenarioTest.__init__
:azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py
Line 86 in 2750c65
Then command index will not be initialized again by test methods.
Testing Guide