diff --git a/start-k8s.sh b/start-k8s.sh index b601b0f36..3b1b278ae 100755 --- a/start-k8s.sh +++ b/start-k8s.sh @@ -118,6 +118,30 @@ no_of_workers="${NO_OF_WORKERS}" \ enable_nmon="${ENABLE_NMON}" \ envsubst <"./k8s/master-deployment.yaml" | kubectl apply -f - +# Wait till all pods are running +cur_timestamp="$(date +%s)" +end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))" +while true; do + if [ "$(date +%s)" -gt "$end_timestamp" ]; then + echo "Pods are not running" + exit 1 + fi + + set +e + pods_status="$(kubectl get pods | grep -v 'STATUS' | grep -v 'Running')" + set -e + if [ -z "$pods_status" ]; then + echo "All pods are running" + break + fi + + echo "----------------------------------------" + echo "Waiting for pods to be running" + echo "----------------------------------------" + echo "$pods_status" + sleep 5 +done + # wait until master starts listening cur_timestamp="$(date +%s)" end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))" diff --git a/test-k8s.sh b/test-k8s.sh index cb925fd8c..084067a4e 100755 --- a/test-k8s.sh +++ b/test-k8s.sh @@ -69,34 +69,6 @@ cp -r env_init env cd "$PROJECT_ROOT" build_and_run_on_k8s -# Wait till all pods are running -cur_timestamp="$(date +%s)" -end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))" -while true; do - if [ "$(date +%s)" -gt "$end_timestamp" ]; then - echo "Pods are not running" - echo "Build log:" - cat "$BUILD_LOG" - echo "Run log:" - cat "$RUN_LOG" - force_remove "${TEST_ROOT}/env" - clear_resources - exit 1 - fi - - set +e - pods_status="$(kubectl get pods | grep -v 'STATUS' | grep -v 'Running')" - set -e - if [ -z "$pods_status" ]; then - echo "All pods are running" - break - fi - - echo "Waiting for pods to be running" - echo "$pods_status" - sleep 5 -done - # Wait till JasmineGraph server start listening cur_timestamp="$(date +%s)" end_timestamp="$((cur_timestamp + TIMEOUT_SECONDS))"