From 7780ac10782786f7ee3b89fa899c5731f0113373 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Wed, 24 Jun 2015 17:02:12 +0000 Subject: [PATCH] Fix gce.sh destory timeouts. --- test/gce.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/gce.sh b/test/gce.sh index be914546..3f54a366 100755 --- a/test/gce.sh +++ b/test/gce.sh @@ -36,11 +36,17 @@ function destroy { names="$(vm_names)" for i in {0..10}; do # gcloud instances delete can sometimes hang. - timeout 60s /bin/bash -c "gcloud compute instances delete --zone $ZONE -q $names || true" - # 124 means it timed out - if [ $? -ne 124 ]; then - return - fi + case $(set +e; timeout 60s /bin/bash -c "gcloud compute instances delete --zone $ZONE -q $names >/dev/null 2>&1 || true"; echo $?) in + 0) + return 0 + ;; + 124) + # 124 means it timed out + break + ;; + *) + return 1 + esac done }