diff --git a/tests/gha-run-k8s-common.sh b/tests/gha-run-k8s-common.sh index 475ab4158..565b89272 100644 --- a/tests/gha-run-k8s-common.sh +++ b/tests/gha-run-k8s-common.sh @@ -104,10 +104,12 @@ function get_cluster_credentials() { function delete_cluster() { test_type="${1:-k8s}" + local rg + rg="$(_print_rg_name ${test_type})" - az group delete \ - -g "$(_print_rg_name ${test_type})" \ - --yes + if [ "$(az group exists -g "${rg}")" == "true" ]; then + az group delete -g "${rg}" --yes + fi } function delete_cluster_kcli() {