From 074dd7bf95d16d1f475689d5de1522a22ce3656d Mon Sep 17 00:00:00 2001 From: Yan Zhu Date: Wed, 30 Aug 2023 16:23:44 +0800 Subject: [PATCH 1/2] Change test to live only --- .../command_modules/resource/tests/latest/test_resource.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py index a26a27e03b8..4576c6980bf 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py @@ -4991,7 +4991,7 @@ def test_bicep_list_versions(self): self.greater_than('length(@)', 0) ]) -class BicepDecompileParamsTest(ScenarioTest): +class BicepDecompileParamsTest(LiveScenarioTest): def setup(self): super().setup() self.cmd('az bicep uninstall') @@ -5014,7 +5014,7 @@ def test_bicep_decompile_params_file(self): if os.path.exists(params_path): os.remove(params_path) -class BicepBuildParamsTest(ScenarioTest): +class BicepBuildParamsTest(LiveScenarioTest): def setup(self): super().setup() self.cmd('az bicep uninstall') From 917006cd44f748eb2c63092099a4cdbd2cb4d5c0 Mon Sep 17 00:00:00 2001 From: Yan Zhu Date: Wed, 30 Aug 2023 18:55:49 +0800 Subject: [PATCH 2/2] Change test functions to live only mode --- .../resource/tests/latest/test_resource_custom.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index c6c37f8607b..a88b0a02380 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -36,6 +36,8 @@ from azure.cli.core.commands import AzCliCommand from azure.cli.core.profiles._shared import ResourceType +from azure.cli.testsdk import live_only + cli_ctx = DummyCli() loader = AzCommandsLoader(cli_ctx, resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) cmd = AzCliCommand(loader, 'test', None) @@ -365,6 +367,7 @@ def test_deployment_bicepparam_file_input_check(self): self.assertEqual(_is_bicepparam_file_provided([['test.bicepparam']]), True) self.assertEqual(_is_bicepparam_file_provided([['test.bicepparam'], ['test.json'], ['{ \"foo\": { \"value\": \"bar\" } }']]), True) + @live_only() def test_bicep_generate_params_defaults(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) bicep_file = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') @@ -374,6 +377,7 @@ def test_bicep_generate_params_defaults(self): is_generated_params_file_exists = os.path.exists(json_file) self.assertTrue(is_generated_params_file_exists) + @live_only() def test_bicep_generate_params_output_format(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) bicep_file = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') @@ -383,6 +387,7 @@ def test_bicep_generate_params_output_format(self): is_generated_params_file_exists = os.path.exists(json_file) self.assertTrue(is_generated_params_file_exists) + @live_only() def test_bicep_generate_params_include_params(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) bicep_file = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') @@ -392,6 +397,7 @@ def test_bicep_generate_params_include_params(self): is_generated_params_file_exists = os.path.exists(json_file) self.assertTrue(is_generated_params_file_exists) + @live_only() def test_bicep_build_params_defaults(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) param_file = os.path.join(curr_dir, 'sample_params.bicepparam').replace('\\', '\\\\') @@ -402,6 +408,7 @@ def test_bicep_build_params_defaults(self): self.assertTrue(is_generated_params_file_exists) + @live_only() def test_bicep_decompile_params_defaults(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) param_file = os.path.join(curr_dir, 'param-validation-params.bicepparam').replace('\\', '\\\\')