From 4e21baa4ff126ada2bc232dff74d6027fd1323be Mon Sep 17 00:00:00 2001 From: Yan Zhu <105691024+yanzhudd@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:49:58 +0800 Subject: [PATCH] {ARM} `az bicep`: Change tests to live only mode (#27288) --- .../command_modules/resource/tests/latest/test_resource.py | 4 ++-- .../resource/tests/latest/test_resource_custom.py | 7 +++++++ 2 files changed, 9 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') 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('\\', '\\\\')