Skip to content

Commit

Permalink
Add service check to verification script
Browse files Browse the repository at this point in the history
Update 7_verify_authentication.sh so that it waits for the services to become
available before querying them

Additionally, update the is_minienv check in utils.sh so that it works when
minishift is not installed
  • Loading branch information
Geri Jennings committed Sep 12, 2018
1 parent 9898ffd commit 6bb630f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
23 changes: 13 additions & 10 deletions 7_verify_authentication.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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

Expand Down
22 changes: 19 additions & 3 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 }')"
}

0 comments on commit 6bb630f

Please sign in to comment.