From e17363cc679c485e8480da9e69f0011d15c84fab Mon Sep 17 00:00:00 2001 From: Joshua Mark Coley Long Date: Mon, 18 Apr 2022 13:44:36 -0400 Subject: [PATCH 1/2] Add cleanup on exit for verify-example.sh to prevent stateful set and deployment leak when running e2e tests --- hack/verify-examples.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hack/verify-examples.sh b/hack/verify-examples.sh index d53bdf7eb6..80b9d094ba 100755 --- a/hack/verify-examples.sh +++ b/hack/verify-examples.sh @@ -74,8 +74,17 @@ if [[ "$1" == "windows" ]]; then ) fi +cleanup_examples() { + for EXAMPLE in "${EXAMPLES[@]}"; do + echo "Attempting deletion of \"EXAMPLE\"" + kubectl delete -f "$EXAMPLE" + done +} + +trap cleanup_examples EXIT + for EXAMPLE in "${EXAMPLES[@]}"; do - rollout_and_wait $EXAMPLE + rollout_and_wait "$EXAMPLE" done echo "deployment examples running completed." From ab613ca49f0818127a9d732ea3cd94fcedf2bc1d Mon Sep 17 00:00:00 2001 From: Joshua Mark Coley Long Date: Tue, 19 Apr 2022 10:13:16 -0400 Subject: [PATCH 2/2] Add ignore-not-found flag --- hack/verify-examples.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/verify-examples.sh b/hack/verify-examples.sh index 80b9d094ba..6ffb16d205 100755 --- a/hack/verify-examples.sh +++ b/hack/verify-examples.sh @@ -76,8 +76,8 @@ fi cleanup_examples() { for EXAMPLE in "${EXAMPLES[@]}"; do - echo "Attempting deletion of \"EXAMPLE\"" - kubectl delete -f "$EXAMPLE" + echo "Attempting deletion of \"$EXAMPLE\"" + kubectl delete -f "$EXAMPLE" --ignore-not-found done }