{testsdk} Copy command index to random config dir#28853
Merged
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Member
Author
calvinhzy
approved these changes
Apr 29, 2024
jiasli
commented
Apr 30, 2024
| files_to_copy = ['commandIndex.json'] | ||
| # 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): |
Member
Author
There was a problem hiding this comment.
Even if GLOBAL_CONFIG_DIR doesn't exist, no error will occur as FileNotFoundError is ignored.
jiasli
commented
Apr 30, 2024
| 'service_principal_entries.bin', 'service_principal_entries.json' | ||
| ]) | ||
|
|
||
| ensure_dir(config_dir) |
Member
Author
There was a problem hiding this comment.
ensure_dir(config_dir) will be called anyway later in azure.cli.core.AzCli.__init__:
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.
wangzelin007
approved these changes
Apr 30, 2024
bebound
approved these changes
Apr 30, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Temporally bypass #28848
Final fix should be done by #28849
Description
Running
test_containerapp_manualjob_withsecret_crudoperations_e2eandtest_hdinsight_applicationsequentially fails withAs explained in #28848 (comment), even after
test_containerapp_manualjob_withsecret_crudoperations_e2efinishes and deletes the random config dir,test_hdinsight_applicationstill 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