From a01cdc96d6f0bba3ba5008d671e2ba5ecc45265f Mon Sep 17 00:00:00 2001 From: kfox1111 Date: Wed, 18 Oct 2023 13:29:56 -0700 Subject: [PATCH] Production test don't cleanup flag (#44) * Production test don't cleanup flag For use in the future with uprade tests, we add a flag -c to the production test to not cleanup after the testing. Signed-off-by: Kevin Fox * Incorperate feedback Signed-off-by: Kevin Fox --------- Signed-off-by: Kevin Fox --- examples/production/run-tests.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/examples/production/run-tests.sh b/examples/production/run-tests.sh index 6e840e9..8fed83a 100755 --- a/examples/production/run-tests.sh +++ b/examples/production/run-tests.sh @@ -19,6 +19,7 @@ helm_install=(helm upgrade --install --create-namespace) ns=spire-server UPGRADE_ARGS="" +CLEANUP=1 for i in "$@"; do case $i in @@ -26,17 +27,23 @@ for i in "$@"; do UPGRADE_ARGS="--repo $UPGRADE_REPO --version $UPGRADE_VERSION" shift # past argument=value ;; + -c) + CLEANUP=0 + shift # past argument=value + ;; esac done teardown() { - helm uninstall --namespace "${ns}" spire 2>/dev/null || true - kubectl delete ns "${ns}" 2>/dev/null || true - kubectl delete ns spire-system 2>/dev/null || true - helm uninstall --namespace cert-manager cert-manager 2>/dev/null || true - kubectl delete ns cert-manager 2>/dev/null || true - helm uninstall --namespace ingress-nginx 2>/dev/null || true - kubectl delete ns ingress-nginx 2>/dev/null || true + if [ "${CLEANUP}" -eq 1 ]; then + helm uninstall --namespace "${ns}" spire 2>/dev/null || true + kubectl delete ns "${ns}" 2>/dev/null || true + kubectl delete ns spire-system 2>/dev/null || true + helm uninstall --namespace cert-manager cert-manager 2>/dev/null || true + kubectl delete ns cert-manager 2>/dev/null || true + helm uninstall --namespace ingress-nginx 2>/dev/null || true + kubectl delete ns ingress-nginx 2>/dev/null || true + fi } trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT