diff --git a/7_verify_authentication.sh b/7_verify_authentication.sh index 7bb7291..a030362 100755 --- a/7_verify_authentication.sh +++ b/7_verify_authentication.sh @@ -10,14 +10,19 @@ set_namespace $TEST_APP_NAMESPACE_NAME # Kubernetes and OpenShift currently deploy different apps; verify differently if [[ "$PLATFORM" = "kubernetes" ]]; then - init_url=$($cli describe service test-app-summon-init | - grep 'LoadBalancer Ingress' | awk '{ print $3 }'):8080 - sidecar_url=$($cli describe service test-app-summon-sidecar | - grep 'LoadBalancer Ingress' | awk '{ print $3 }'):8080 - secretless_url=$($cli describe service test-app-secretless | - grep 'LoadBalancer Ingress' | awk '{ print $3 }'):8080 - - echo -e "Adding entry to the init app\n" + echo "Waiting for services to become available" + while [ -z "$(service_ip "test-app-summon-init")" ] || + [ -z "$(service_ip "test-app-summon-sidecar")" ] || + [ -z "$(service_ip "test-app-secretless")" ]; do + printf "." + sleep 1 + done + + init_url=$(service_ip test-app-summon-init):8080 + sidecar_url=$(service_ip test-app-summon-sidecar):8080 + secretless_url=$(service_ip test-app-secretless):8080 + + echo -e "\nAdding entry to the init app\n" curl \ -d '{"name": "Mr. Init"}' \ -H "Content-Type: application/json" \ @@ -35,8 +40,6 @@ if [[ "$PLATFORM" = "kubernetes" ]]; then -H "Content-Type: application/json" \ $secretless_url/pet - echo -e "Remember that they are both using the same DB backend...\n" - echo -e "Querying init app\n" curl $init_url/pets diff --git a/utils.sh b/utils.sh index eb329d2..70a8c28 100755 --- a/utils.sh +++ b/utils.sh @@ -133,9 +133,25 @@ function wait_for_it() { } function is_minienv() { - if [[ $MINIKUBE == false && "$(minishift status | grep Running)" = "" ]]; then - false + if hash minishift 2>/dev/null; then + # Check if Minishift is running too + if [[ $MINIKUBE == false && "$(minishift status | grep Running)" = "" ]]; then + false + else + true + fi else - true + if [[ $MINIKUBE == false ]]; then + false + else + true + fi fi } + +function service_ip() { + local service=$1 + + echo "$($cli describe service $service | grep 'LoadBalancer Ingress' | + awk '{ print $3 }')" +}