From 83847eac798f9c977f17bea5e6c3f190d8215e16 Mon Sep 17 00:00:00 2001 From: Lee Verberne Date: Thu, 14 Sep 2017 12:00:29 +0200 Subject: [PATCH] Test gcloud exit when detecting master for e2e e2e tests set errexit, so without testing the exit status of a command its scripted error message will not be printed. --- cluster/gce/util.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 3917d72a554..3e481749db2 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -401,12 +401,12 @@ function detect-master() { if [[ -z "${KUBE_MASTER_IP-}" ]]; then local master_address_name="${MASTER_NAME}-ip" echo "Looking for address '${master_address_name}'" >&2 - KUBE_MASTER_IP=$(gcloud compute addresses describe "${master_address_name}" \ - --project "${PROJECT}" --region "${REGION}" -q --format='value(address)') - fi - if [[ -z "${KUBE_MASTER_IP-}" ]]; then - echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" >&2 - exit 1 + if ! KUBE_MASTER_IP=$(gcloud compute addresses describe "${master_address_name}" \ + --project "${PROJECT}" --region "${REGION}" -q --format='value(address)') || \ + [[ -z "${KUBE_MASTER_IP-}" ]]; then + echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" >&2 + exit 1 + fi fi echo "Using master: $KUBE_MASTER (external IP: $KUBE_MASTER_IP)" >&2 }