Add missing no cleanup flags to example tests (#79)

This commit is contained in:
kfox1111
2023-11-05 14:10:16 +01:00
committed by GitHub
parent 81cc2dc573
commit d6583be179
4 changed files with 68 additions and 16 deletions
+15 -2
View File
@@ -12,9 +12,22 @@ source "${TESTDIR}/common.sh"
helm_install=(helm upgrade --install --create-namespace)
ns=spire-system
CLEANUP=1
for i in "$@"; do
case $i in
-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
if [ "${CLEANUP}" -eq 1 ]; then
helm uninstall --namespace "${ns}" spire 2>/dev/null || true
kubectl delete ns "${ns}" 2>/dev/null || true
fi
}
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT