Skip to content

Commit

Permalink
Merge pull request #414 from erikwilson/cleanup-test-cleanup
Browse files Browse the repository at this point in the history
Cleanup the test-cleanup function
  • Loading branch information
erikwilson authored Oct 1, 2020
2 parents 5658288 + a834e60 commit 3a87c15
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/test-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export -f sonobuoy-test

test-cleanup() {
local code=$?
set +e +x
set +e -x
echo 'Cleaning up...'
trap - EXIT INT TERM
if [[ $code -ne 0 ]]; then
Expand All @@ -258,13 +258,14 @@ test-cleanup() {
for name in $TEST_DIR/*/*/metadata/name; do
[ -f "$name" ] || continue
local container=$(cat $name)
docker rm -f -v $container >/dev/null 2>&1 &
echo "Removing container $container"
docker rm -f -v $container
done
if [ "$TEST_CLEANUP" = true ]; then
echo "Removing $TEST_DIR"
rm -rf $TEST_DIR >/dev/null 2>&1 &
echo "Removing test directory $TEST_DIR"
rm -rf $TEST_DIR
fi
[ -f "$PROVISION_LOCK" ] && rm $PROVISION_LOCK >/dev/null 2>&1 &
[ -f "$PROVISION_LOCK" ] && rm $PROVISION_LOCK
echo
echo -n "Test $(basename $TEST_DIR) "
if [ $code -eq 0 ]; then
Expand Down

0 comments on commit 3a87c15

Please sign in to comment.