From 548288d1b7ac73c92556c3a49977a5a2e1688cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wa=C5=9B?= Date: Thu, 13 Jun 2024 23:39:01 +0200 Subject: [PATCH] Fix deleting CRDs at the end of tests --- test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 75699c50..fd058131 100755 --- a/test.sh +++ b/test.sh @@ -110,7 +110,10 @@ done if [ "$CLEANUP_NAMESPACE" == "true" ]; then helm -n "$NAMESPACE" uninstall prometheus-operator --ignore-not-found kubectl delete namespace "$NAMESPACE" - kubectl delete crd $(kubectl api-resources --api-group=monitoring.coreos.com --output name) + mapfile -t crds < <(kubectl api-resources --api-group=monitoring.coreos.com --output name) + if [ ${#crds[@]} -ne 0 ]; then + kubectl delete crd "${crds[@]}" + fi fi exit $result