From b3c934cde1af64c05d7e3e22821b39cfc9109c55 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Mon, 16 Jun 2014 20:42:17 -0700 Subject: [PATCH 1/2] Parse status; makes test much faster --- hack/e2e-suite/basic.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/hack/e2e-suite/basic.sh b/hack/e2e-suite/basic.sh index bbfe8cef9bb..9ecd6d6c81f 100755 --- a/hack/e2e-suite/basic.sh +++ b/hack/e2e-suite/basic.sh @@ -26,10 +26,27 @@ detect-project # Launch a container $CLOUDCFG -p 8080:80 run dockerfile/nginx 2 myNginx +function remove-quotes() { + local in=$1 + stripped="${in%\"}" + stripped="${stripped#\"}" + echo $stripped +} + +POD_ID_LIST=$($CLOUDCFG -json -l name=myNginx list pods | jq ".items[].id") # Container turn up on a clean cluster can take a while for the docker image pull. -# Sleep for 2 minutes just to be sure. -echo "Waiting for containers to come up." -sleep 120 +ALL_RUNNING=false +while [[ $ALL_RUNNING -ne "true" ]]; do + echo "Waiting for containers to come up." + sleep 5 + ALL_RUNNING=true + for id in $POD_ID_LIST; do + CURRENT_STATUS=$(remove-quotes $($CLOUDCFG -json get "pods/$(remove-quotes ${id})" | jq '.currentState.status')) + if [[ $CURRENT_STATUS -ne "Running" ]]; then + ALL_RUNNING=false + fi + done +done # Get minion IP addresses detect-minions From b709532fdd6836fad5ea02a539659820e8b58145 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Mon, 16 Jun 2014 20:45:38 -0700 Subject: [PATCH 2/2] Move jq requirement message --- hack/e2e-suite/guestbook.sh | 7 ------- hack/e2e-test.sh | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hack/e2e-suite/guestbook.sh b/hack/e2e-suite/guestbook.sh index f51251a146c..96023578793 100755 --- a/hack/e2e-suite/guestbook.sh +++ b/hack/e2e-suite/guestbook.sh @@ -20,13 +20,6 @@ set -e -HAVE_JQ=$(which jq) -if [[ -z ${HAVE_JQ} ]]; then - echo "Please install jq, e.g.: 'sudo apt-get install jq' or, " - echo "if you're on a mac with homebrew, 'brew install jq'." - exit 1 -fi - source "${KUBE_REPO_ROOT}/cluster/util.sh" GUESTBOOK="${KUBE_REPO_ROOT}/examples/guestbook" diff --git a/hack/e2e-test.sh b/hack/e2e-test.sh index 3c14ff22d29..a7fc30bc417 100755 --- a/hack/e2e-test.sh +++ b/hack/e2e-test.sh @@ -25,6 +25,13 @@ LEAVE_UP=${2:-0} # Exit on error set -e +HAVE_JQ=$(which jq) +if [[ -z ${HAVE_JQ} ]]; then + echo "Please install jq, e.g.: 'sudo apt-get install jq' or, " + echo "if you're on a mac with homebrew, 'brew install jq'." + exit 1 +fi + # Use testing config export KUBE_CONFIG_FILE="config-test.sh" export KUBE_REPO_ROOT="$(dirname $0)/.."