diff --git a/src/aks-preview/az_aks_tool/main.py b/src/aks-preview/az_aks_tool/main.py index 9864eeaaa72..57b8f77bd75 100644 --- a/src/aks-preview/az_aks_tool/main.py +++ b/src/aks-preview/az_aks_tool/main.py @@ -67,6 +67,9 @@ def main(): print("raw args: {}".format(sys.argv)) args = init_argparse(sys.argv[1:]) + # check directory + utils.create_directory(args.report_path) + # setup logger root_module_name = log.parse_module_name(levels=1) log.setup_logging(root_module_name, os.path.join( diff --git a/src/aks-preview/az_aks_tool/utils.py b/src/aks-preview/az_aks_tool/utils.py index f92117bbf56..6607d026a1b 100644 --- a/src/aks-preview/az_aks_tool/utils.py +++ b/src/aks-preview/az_aks_tool/utils.py @@ -8,12 +8,21 @@ import sys import re import logging +import pathlib -import az_aks_tool.const as const import az_aks_tool.filter as custom_filter logger = logging.getLogger(__name__) +def create_directory(dir_path): + if dir_path: + if not os.path.isdir(dir_path): + print("Directory '{}' not exist, creating...".format(dir_path)) + pathlib.Path(dir_path).mkdir(parents=True, exist_ok=True) + else: + print("Invalid dir path: '{}'".format(dir_path)) + + def check_file_existence(file_path): if file_path is not None and os.path.isfile(file_path): return True diff --git a/src/aks-preview/azcli_aks_live_test/ext_matrix_default.json b/src/aks-preview/azcli_aks_live_test/ext_matrix_default.json index 13d3d7295af..cbbb90d3ca4 100644 --- a/src/aks-preview/azcli_aks_live_test/ext_matrix_default.json +++ b/src/aks-preview/azcli_aks_live_test/ext_matrix_default.json @@ -21,11 +21,15 @@ "test_aks_update_azurekeyvaultsecretsprovider_with_secret_rotation", "test_aks_enable_addon_with_azurekeyvaultsecretsprovider", "test_aks_enable_addon_with_gitops", - "test_aks_create_with_fips" + "test_aks_create_with_fips", + "test_aks_disable_local_accounts", + "test_aks_nodepool_add_with_ossku", + "test_aks_create_with_ossku" ], "unknown": [ "test_aks_create_and_update_with_managed_aad_enable_azure_rbac", - "test_aks_create_with_virtual_node_addon" + "test_aks_create_with_virtual_node_addon", + "test_aks_update_to_msi_cluster_with_addons" ], "code bug": [ "test_aks_create_with_ingress_appgw_addon_with_deprecated_subet_prefix", @@ -36,4 +40,4 @@ "test_aks_create_with_ingress_appgw_addon" ] } -} \ No newline at end of file +} diff --git a/src/aks-preview/azcli_aks_live_test/test_ext_live.sh b/src/aks-preview/azcli_aks_live_test/test_ext_live.sh index af81461ce74..0f7129a3363 100755 --- a/src/aks-preview/azcli_aks_live_test/test_ext_live.sh +++ b/src/aks-preview/azcli_aks_live_test/test_ext_live.sh @@ -14,6 +14,7 @@ set -o xtrace [[ -z "${TEST_MODE}" ]] && (echo "TEST_MODE is empty"; exit 1) [[ -z "${PARALLELISM}" ]] && (echo "PARALLELISM is empty"; exit 1) [[ -z "${TEST_CASES}" ]] && (echo "TEST_CASES is empty") +[[ -z "${EXT_TEST_MATRIX}" ]] && (echo "EXT_TEST_MATRIX is empty") [[ -z "${EXT_TEST_FILTER}" ]] && (echo "EXT_TEST_FILTER is empty") [[ -z "${EXT_TEST_COVERAGE}" ]] && (echo "EXT_TEST_COVERAGE is empty") @@ -55,6 +56,10 @@ fi if [[ -n ${TEST_CASES} ]]; then run_flags+=" -t ${TEST_CASES}" fi +# ext matrix +if [[ -n ${EXT_TEST_MATRIX} ]]; then + run_flags+=" -em ${EXT_TEST_MATRIX}" +fi # ext extra filter if [[ -n ${EXT_TEST_FILTER} ]]; then run_flags+=" -ef ${EXT_TEST_FILTER}" @@ -70,7 +75,7 @@ if [[ ${TEST_MODE} == "record" || ${TEST_MODE} == "all" ]]; then run_flags+=" --json-report-file=ext_report.json" run_flags+=" --xml-file=ext_result.xml" echo "run flags: ${run_flags}" - echo ${run_flags} | xargs python -u az_aks_tool/main.py + echo "${run_flags}" | xargs python -u az_aks_tool/main.py fi # live test @@ -82,5 +87,5 @@ if [[ ${TEST_MODE} == "live" || ${TEST_MODE} == "all" ]]; then run_flags+=" -l --json-report-file=ext_live_report.json" run_flags+=" --xml-file=ext_live_result.xml" echo "run flags: ${run_flags}" - echo ${run_flags} | xargs python -u az_aks_tool/main.py + echo "${run_flags}" | xargs python -u az_aks_tool/main.py fi diff --git a/src/aks-preview/azcli_aks_live_test/transcribe_env.sh b/src/aks-preview/azcli_aks_live_test/transcribe_env.sh index 52b2ae8b2a7..3d256969fda 100755 --- a/src/aks-preview/azcli_aks_live_test/transcribe_env.sh +++ b/src/aks-preview/azcli_aks_live_test/transcribe_env.sh @@ -17,6 +17,7 @@ set -o xtrace [[ -z "${TEST_MODE}" ]] && (echo "TEST_MODE is empty"; exit 1) [[ -z "${PARALLELISM}" ]] && (echo "PARALLELISM is empty"; exit 1) [[ -z "${TEST_CASES}" ]] && (echo "TEST_CASES is empty") +[[ -z "${EXT_TEST_MATRIX}" ]] && (echo "EXT_TEST_MATRIX is empty") [[ -z "${EXT_TEST_FILTER}" ]] && (echo "EXT_TEST_FILTER is empty") [[ -z "${EXT_TEST_COVERAGE}" ]] && (echo "EXT_TEST_COVERAGE is empty") [[ -z "${CLI_REPO}" ]] && (echo "CLI_REPO is empty"; exit 1) @@ -50,6 +51,7 @@ echo "COVERAGE=${COVERAGE}" >> env.list echo "TEST_MODE=${TEST_MODE}" >> env.list echo "PARALLELISM=${PARALLELISM}" >> env.list echo "TEST_CASES=${TEST_CASES}" >> env.list +echo "EXT_TEST_MATRIX=${EXT_TEST_MATRIX}" >> env.list echo "EXT_TEST_FILTER=${EXT_TEST_FILTER}" >> env.list echo "EXT_TEST_COVERAGE=${EXT_TEST_COVERAGE}" >> env.list diff --git a/src/aks-preview/azcli_aks_live_test/vsts-azcli-aks-live-test.yaml b/src/aks-preview/azcli_aks_live_test/vsts-azcli-aks-live-test.yaml index 3cc0f2fd288..48c9e50acd3 100644 --- a/src/aks-preview/azcli_aks_live_test/vsts-azcli-aks-live-test.yaml +++ b/src/aks-preview/azcli_aks_live_test/vsts-azcli-aks-live-test.yaml @@ -58,7 +58,9 @@ jobs: inputs: contents: 'reports/**' targetFolder: $(Build.ArtifactStagingDirectory) + condition: succeededOrFailed() - task: PublishBuildArtifacts@1 inputs: pathToPublish: $(Build.ArtifactStagingDirectory) artifactName: 'live test reports' + condition: succeededOrFailed() diff --git a/src/aks-preview/azcli_aks_live_test/vsts-azcli-aks-unit-test.yaml b/src/aks-preview/azcli_aks_live_test/vsts-azcli-aks-unit-test.yaml index 1363914b93a..80ee11eb468 100644 --- a/src/aks-preview/azcli_aks_live_test/vsts-azcli-aks-unit-test.yaml +++ b/src/aks-preview/azcli_aks_live_test/vsts-azcli-aks-unit-test.yaml @@ -58,7 +58,9 @@ jobs: inputs: contents: 'reports/**' targetFolder: $(Build.ArtifactStagingDirectory) + condition: succeededOrFailed() - task: PublishBuildArtifacts@1 inputs: pathToPublish: $(Build.ArtifactStagingDirectory) artifactName: 'unit test reports' + condition: succeededOrFailed() diff --git a/src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py b/src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py index 823d1b809d2..1432399a755 100644 --- a/src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py +++ b/src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py @@ -1649,7 +1649,7 @@ def test_aks_custom_kubelet_identity(self, resource_group, resource_group_locati @live_only() @AllowLargeResponse() - @ResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2') + @AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2') def test_aks_disable_local_accounts(self, resource_group, resource_group_location): aks_name = self.create_random_name('cliakstest', 16) self.kwargs.update({