From d2ff21d3d5bb3768755f51a77c92ac9c26301a0f Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Tue, 16 Dec 2014 13:16:17 -0800 Subject: [PATCH] Wait for not pending, not for running. When failures occur, we go to 'Terminated' which can cause indefinite blocking. --- hack/e2e-suite/liveness.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hack/e2e-suite/liveness.sh b/hack/e2e-suite/liveness.sh index 638def84021..dcb5e2a0e3b 100755 --- a/hack/e2e-suite/liveness.sh +++ b/hack/e2e-suite/liveness.sh @@ -30,7 +30,7 @@ function teardown() { ${KUBECFG} delete pods/liveness-http } -function waitForRunning() { +function waitForNotPending() { pod_id_list=$($KUBECFG '-template={{range.items}}{{.id}} {{end}}' -l test=liveness list pods) # Pod turn up on a clean cluster can take a while for the docker image pull. all_running=0 @@ -40,7 +40,7 @@ function waitForRunning() { all_running=1 for id in $pod_id_list; do current_status=$($KUBECFG -template '{{.currentState.status}}' get pods/$id) || true - if [[ "$current_status" != "Running" ]]; then + if [[ "$current_status" == "Pending" ]]; then all_running=0 break fi @@ -58,7 +58,7 @@ function waitForRunning() { trap "teardown" EXIT ${KUBECFG} -c ${KUBE_ROOT}/examples/liveness/http-liveness.yaml create pods -waitForRunning +waitForNotPending before=$(${KUBECFG} '-template={{.currentState.info.liveness.restartCount}}' get pods/liveness-http) @@ -67,7 +67,7 @@ for i in $(seq 1 24); do sleep 10 after=$(${KUBECFG} '-template={{.currentState.info.liveness.restartCount}}' get pods/liveness-http) echo "Restarts: ${after} > ${before}" - if [[ "${after}" > "${before} ]]; then + if [[ "${after}" > "${before}" ]]; then break fi done