Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add configurable TEST_APP_DATABASE + mysql option #51

Merged
merged 31 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8304bc1
add suport for mysql
doodlesbykumbi Mar 15, 2019
19e13e3
run test cases in sequence
doodlesbykumbi Mar 17, 2019
8100198
run mysql and postgres tests in parallel
doodlesbykumbi Mar 18, 2019
e1fde03
show state of pods before exit
doodlesbykumbi Mar 18, 2019
976cf39
add health checks
doodlesbykumbi Mar 18, 2019
09cfa9d
wait for port-forwarding
doodlesbykumbi Mar 18, 2019
a7a0283
stop should list pods before exiting
doodlesbykumbi Mar 18, 2019
e1f7ba5
dump secretless logs
doodlesbykumbi Mar 18, 2019
9450dc0
make generated files unique across tests
doodlesbykumbi Mar 18, 2019
0866984
no --all-containers
doodlesbykumbi Mar 18, 2019
0353016
fix args .__.
doodlesbykumbi Mar 18, 2019
244d192
round infinity
doodlesbykumbi Mar 18, 2019
061141b
no logs
doodlesbykumbi Mar 18, 2019
279adb6
use kubernetes-conjur-deploy with increased readinessProbe timeoutSec…
doodlesbykumbi Mar 18, 2019
73474ec
wait for service ips to complete setup
doodlesbykumbi Mar 18, 2019
c619f7e
add netcat to test container
doodlesbykumbi Mar 18, 2019
4dd3b0e
actually verify urls
doodlesbykumbi Mar 18, 2019
c04839e
try doing everything in parallel :)
doodlesbykumbi Mar 18, 2019
87c22a9
fix function decl
doodlesbykumbi Mar 18, 2019
1a67b26
redefine ready
doodlesbykumbi Mar 18, 2019
0fc72d7
fix mysql tests description
doodlesbykumbi Mar 18, 2019
41e1f27
cleanup + useful comments
doodlesbykumbi Mar 19, 2019
6c895d8
fix urls + silence curl output in urls wait
doodlesbykumbi Mar 19, 2019
1a09638
address feedback
doodlesbykumbi Mar 25, 2019
b93ec12
all temp files are of the form tmp.*
doodlesbykumbi Mar 25, 2019
9193d9b
more cleanup
doodlesbykumbi Mar 25, 2019
7fb953a
fix tmp.summon* copy
doodlesbykumbi Mar 25, 2019
d9c17d5
more cleanup
doodlesbykumbi Mar 26, 2019
e90d14a
minor fix
doodlesbykumbi Mar 26, 2019
786394a
bump test_app_summon builder image to ruby:2.4
doodlesbykumbi Mar 26, 2019
ab32540
bump test_app_summon builder image for OC to ruby:2.4
doodlesbykumbi Mar 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
policy/generated/*
pg/schema.sql
openshift/postgres.yml
test_app_summon/secrets.yml
test_app_summon/summon*
tmp.*
output/
2 changes: 2 additions & 0 deletions 0_check_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ check_env_var "DOCKER_REGISTRY_PATH"
check_env_var "CONJUR_ACCOUNT"
check_env_var "CONJUR_ADMIN_PASSWORD"
check_env_var "AUTHENTICATOR_ID"
check_env_var "TEST_APP_DATABASE"
ensure_env_database
8 changes: 4 additions & 4 deletions 1_create_test_app_namespace.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
set -euo pipefail

. utils.sh
Expand All @@ -22,14 +22,14 @@ else
elif [ $PLATFORM = 'openshift' ]; then
$cli new-project $TEST_APP_NAMESPACE_NAME
fi

set_namespace $TEST_APP_NAMESPACE_NAME
fi

$cli delete --ignore-not-found rolebinding test-app-conjur-authenticator-role-binding-$CONJUR_NAMESPACE_NAME

sed -e "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" ./$PLATFORM/test-app-conjur-authenticator-role-binding.yml |
sed -e "s#{{ CONJUR_NAMESPACE_NAME }}#$CONJUR_NAMESPACE_NAME#g" |
sed "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" ./$PLATFORM/test-app-conjur-authenticator-role-binding.yml |
sed "s#{{ CONJUR_NAMESPACE_NAME }}#$CONJUR_NAMESPACE_NAME#g" |
$cli create -f -

if [[ $PLATFORM == openshift ]]; then
Expand Down
27 changes: 17 additions & 10 deletions 2_load_conjur_policies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ announce "Generating Conjur policy."
pushd policy
mkdir -p ./generated

sed -e "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" ./templates/cluster-authn-svc-def.template.yml > ./generated/cluster-authn-svc.yml
# NOTE: generated files are prefixed with the test app namespace to allow for parallel CI

sed -e "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" ./templates/project-authn-def.template.yml |
sed -e "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" > ./generated/project-authn.yml
sed "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" ./templates/cluster-authn-svc-def.template.yml > ./generated/$TEST_APP_NAMESPACE_NAME.cluster-authn-svc.yml

sed -e "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" ./templates/app-identity-def.template.yml |
sed -e "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" > ./generated/app-identity.yml
sed "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" ./templates/project-authn-def.template.yml |
sed "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" > ./generated/$TEST_APP_NAMESPACE_NAME.project-authn.yml

sed "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" ./templates/app-identity-def.template.yml |
sed "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" > ./generated/$TEST_APP_NAMESPACE_NAME.app-identity.yml
popd

# Create the random database password
Expand All @@ -35,6 +37,7 @@ if [[ "${DEPLOY_MASTER_CLUSTER}" == "true" ]]; then
CONJUR_ADMIN_PASSWORD=${CONJUR_ADMIN_PASSWORD} \
DB_PASSWORD=${password} \
TEST_APP_NAMESPACE_NAME=${TEST_APP_NAMESPACE_NAME} \
TEST_APP_DATABASE=${TEST_APP_DATABASE} \
CONJUR_VERSION=${CONJUR_VERSION} \
/policy/load_policies.sh
"
Expand All @@ -46,14 +49,18 @@ if [[ "${DEPLOY_MASTER_CLUSTER}" == "true" ]]; then
set_namespace "$TEST_APP_NAMESPACE_NAME"
fi

# Set DB password in DB schema
pushd pg
sed -e "s#{{ TEST_APP_PG_PASSWORD }}#$password#g" ./schema.template.sql > ./schema.sql
# Set DB password in Kubernetes manifests
# NOTE: generated files are prefixed with the test app namespace to allow for parallel CI
pushd kubernetes
sed "s#{{ TEST_APP_DB_PASSWORD }}#$password#g" ./postgres.template.yml > ./tmp.${TEST_APP_NAMESPACE_NAME}.postgres.yml
sed "s#{{ TEST_APP_DB_PASSWORD }}#$password#g" ./mysql.template.yml > ./tmp.${TEST_APP_NAMESPACE_NAME}.mysql.yml
popd

# Set DB password in OC deployment manifest
# Set DB password in OC manifests
# NOTE: generated files are prefixed with the test app namespace to allow for parallel CI
pushd openshift
sed -e "s#{{ TEST_APP_PG_PASSWORD }}#$password#g" ./postgres.template.yml > ./postgres.yml
sed "s#{{ TEST_APP_DB_PASSWORD }}#$password#g" ./postgres.template.yml > ./tmp.${TEST_APP_NAMESPACE_NAME}.postgres.yml
sed "s#{{ TEST_APP_DB_PASSWORD }}#$password#g" ./mysql.template.yml > ./tmp.${TEST_APP_NAMESPACE_NAME}.mysql.yml
popd

announce "Added DB password value: $password"
4 changes: 2 additions & 2 deletions 4_store_conjur_cert.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
set -euo pipefail

. utils.sh
Expand All @@ -9,7 +9,7 @@ set_namespace $CONJUR_NAMESPACE_NAME

echo "Retrieving Conjur certificate."

follower_pod_name=$($cli get pods -l role=follower --no-headers | awk '{ print $1 }' | head -1)
follower_pod_name=$($cli get pods --selector role=follower --no-headers | awk '{ print $1 }' | head -1)
ssl_cert=$($cli exec $follower_pod_name -- cat /opt/conjur/etc/ssl/conjur.pem)

set_namespace $TEST_APP_NAMESPACE_NAME
Expand Down
9 changes: 6 additions & 3 deletions 5_build_and_push_containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ pushd test_app_summon

# retrieve the summon binaries
id=$(docker create test-app-builder)
docker cp $id:/usr/local/lib/summon/summon-conjur ./
docker cp $id:/usr/local/bin/summon ./
docker cp $id:/usr/local/lib/summon/summon-conjur ./tmp.summon-conjur
docker cp $id:/usr/local/bin/summon ./tmp.summon
docker rm -v $id
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use long-form flag

fi


for app_type in "${APPS[@]}"; do
# prep secrets.yml
sed -e "s#{{ TEST_APP_NAME }}#test-summon-$app_type-app#g" ./secrets.template.yml > secrets.yml
# NOTE: generated files are prefixed with the test app namespace to allow for parallel CI
sed "s#{{ TEST_APP_NAME }}#test-summon-$app_type-app#g" ./secrets.template.yml > "tmp.$TEST_APP_NAMESPACE_NAME.secrets.yml"

dockerfile="Dockerfile"
if [[ "$PLATFORM" == "openshift" ]]; then
Expand All @@ -37,6 +39,7 @@ pushd test_app_summon

echo "Building test app image"
docker build \
--build-arg namespace=$TEST_APP_NAMESPACE_NAME\
-t test-app:$CONJUR_NAMESPACE_NAME \
-f $dockerfile .
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use long-form options


Expand Down
122 changes: 75 additions & 47 deletions 6_deploy_test_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ init_registry_creds() {
if [[ "$PLATFORM" == "kubernetes" ]]; then
if [[ "${DOCKER_EMAIL}" != "" ]]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to single if to avoid superfluous nesting:

if [[ "$PLATFORM" == "kubernetes" ]] && [[ -n "${DOCKER_EMAIL}" ]]; then

announce "Creating image pull secret."

kubectl delete --ignore-not-found secret dockerpullsecret

kubectl create secret docker-registry dockerpullsecret \
Expand All @@ -38,16 +38,16 @@ init_registry_creds() {
fi
elif [[ "$PLATFORM" == "openshift" ]]; then
announce "Creating image pull secret."

$cli delete --ignore-not-found secrets dockerpullsecret

$cli secrets new-dockercfg dockerpullsecret \
--docker-server=${DOCKER_REGISTRY_PATH} \
--docker-username=_ \
--docker-password=$($cli whoami -t) \
--docker-email=_
$cli secrets add serviceaccount/default secrets/dockerpullsecret --for=pull

$cli secrets add serviceaccount/default secrets/dockerpullsecret --for=pull
fi
}

Expand Down Expand Up @@ -84,20 +84,34 @@ deploy_app_backend() {
statefulset/summon-init-pg \
statefulset/summon-sidecar-pg \
statefulset/secretless-pg \
statefulset/summon-init-mysql \
statefulset/summon-sidecar-mysql \
statefulset/secretless-mysql \
secret/test-app-backend-certs

echo "Create secrets for test app backend"
$cli --namespace $TEST_APP_NAMESPACE_NAME \
create secret generic \
test-app-backend-certs \
--from-file=server.crt=./etc/ca.pem \
--from-file=server.key=./etc/ca-key.pem

echo "Deploying test app backend"
test_app_pg_docker_image=$(platform_image test-app-pg)
sed -e "s#{{ TEST_APP_PG_DOCKER_IMAGE }}#$test_app_pg_docker_image#g" ./$PLATFORM/postgres.yml |
sed -e "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
ensure_env_database
case "${TEST_APP_DATABASE}" in
postgres)
echo "Create secrets for test app backend"
$cli --namespace $TEST_APP_NAMESPACE_NAME \
create secret generic \
test-app-backend-certs \
--from-file=server.crt=./etc/ca.pem \
--from-file=server.key=./etc/ca-key.pem

echo "Deploying test app backend"
test_app_pg_docker_image=$(platform_image test-app-pg)
sed "s#{{ TEST_APP_PG_DOCKER_IMAGE }}#$test_app_pg_docker_image#g" ./$PLATFORM/tmp.${TEST_APP_NAMESPACE_NAME}.postgres.yml |
sed "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
$cli create -f -
;;
mysql)
echo "Deploying test app backend"
test_app_mysql_docker_image="mysql/mysql-server:5.7"
sed "s#{{ TEST_APP_DATABASE_DOCKER_IMAGE }}#$test_app_mysql_docker_image#g" ./$PLATFORM/tmp.${TEST_APP_NAMESPACE_NAME}.mysql.yml | sed "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" | $cli create -f -
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd add linebreaks after the pipes for readability

;;
esac

}

###########################
Expand All @@ -116,18 +130,18 @@ deploy_sidecar_app() {

sleep 5

sed -e "s#{{ TEST_APP_DOCKER_IMAGE }}#$test_sidecar_app_docker_image#g" ./$PLATFORM/test-app-summon-sidecar.yml |
sed -e "s#{{ AUTHENTICATOR_CLIENT_IMAGE }}#$authenticator_client_image#g" |
sed -e "s#{{ IMAGE_PULL_POLICY }}#$IMAGE_PULL_POLICY#g" |
sed -e "s#{{ CONJUR_VERSION }}#$CONJUR_VERSION#g" |
sed -e "s#{{ CONJUR_ACCOUNT }}#$CONJUR_ACCOUNT#g" |
sed -e "s#{{ CONJUR_AUTHN_LOGIN_PREFIX }}#$conjur_authn_login_prefix#g" |
sed -e "s#{{ CONJUR_APPLIANCE_URL }}#$conjur_appliance_url#g" |
sed -e "s#{{ CONJUR_AUTHN_URL }}#$conjur_authenticator_url#g" |
sed -e "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed -e "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" |
sed -e "s#{{ CONFIG_MAP_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed -e "s#{{ CONJUR_VERSION }}#'$CONJUR_VERSION'#g" |
sed "s#{{ TEST_APP_DOCKER_IMAGE }}#$test_sidecar_app_docker_image#g" ./$PLATFORM/test-app-summon-sidecar.yml |
sed "s#{{ AUTHENTICATOR_CLIENT_IMAGE }}#$authenticator_client_image#g" |
sed "s#{{ IMAGE_PULL_POLICY }}#$IMAGE_PULL_POLICY#g" |
sed "s#{{ CONJUR_VERSION }}#$CONJUR_VERSION#g" |
sed "s#{{ CONJUR_ACCOUNT }}#$CONJUR_ACCOUNT#g" |
sed "s#{{ CONJUR_AUTHN_LOGIN_PREFIX }}#$conjur_authn_login_prefix#g" |
sed "s#{{ CONJUR_APPLIANCE_URL }}#$conjur_appliance_url#g" |
sed "s#{{ CONJUR_AUTHN_URL }}#$conjur_authenticator_url#g" |
sed "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" |
sed "s#{{ CONFIG_MAP_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed "s#{{ CONJUR_VERSION }}#'$CONJUR_VERSION'#g" |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful sed!

$cli create -f -

if [[ "$PLATFORM" == "openshift" ]]; then
Expand All @@ -153,18 +167,18 @@ deploy_init_container_app() {

sleep 5

sed -e "s#{{ TEST_APP_DOCKER_IMAGE }}#$test_init_app_docker_image#g" ./$PLATFORM/test-app-summon-init.yml |
sed -e "s#{{ AUTHENTICATOR_CLIENT_IMAGE }}#$authenticator_client_image#g" |
sed -e "s#{{ IMAGE_PULL_POLICY }}#$IMAGE_PULL_POLICY#g" |
sed -e "s#{{ CONJUR_VERSION }}#$CONJUR_VERSION#g" |
sed -e "s#{{ CONJUR_ACCOUNT }}#$CONJUR_ACCOUNT#g" |
sed -e "s#{{ CONJUR_AUTHN_LOGIN_PREFIX }}#$conjur_authn_login_prefix#g" |
sed -e "s#{{ CONJUR_APPLIANCE_URL }}#$conjur_appliance_url#g" |
sed -e "s#{{ CONJUR_AUTHN_URL }}#$conjur_authenticator_url#g" |
sed -e "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed -e "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" |
sed -e "s#{{ CONFIG_MAP_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed -e "s#{{ CONJUR_VERSION }}#'$CONJUR_VERSION'#g" |
sed "s#{{ TEST_APP_DOCKER_IMAGE }}#$test_init_app_docker_image#g" ./$PLATFORM/test-app-summon-init.yml |
sed "s#{{ AUTHENTICATOR_CLIENT_IMAGE }}#$authenticator_client_image#g" |
sed "s#{{ IMAGE_PULL_POLICY }}#$IMAGE_PULL_POLICY#g" |
sed "s#{{ CONJUR_VERSION }}#$CONJUR_VERSION#g" |
sed "s#{{ CONJUR_ACCOUNT }}#$CONJUR_ACCOUNT#g" |
sed "s#{{ CONJUR_AUTHN_LOGIN_PREFIX }}#$conjur_authn_login_prefix#g" |
sed "s#{{ CONJUR_APPLIANCE_URL }}#$conjur_appliance_url#g" |
sed "s#{{ CONJUR_AUTHN_URL }}#$conjur_authenticator_url#g" |
sed "s#{{ TEST_APP_NAMESPACE_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed "s#{{ AUTHENTICATOR_ID }}#$AUTHENTICATOR_ID#g" |
sed "s#{{ CONFIG_MAP_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed "s#{{ CONJUR_VERSION }}#'$CONJUR_VERSION'#g" |
$cli create -f -

if [[ "$PLATFORM" == "openshift" ]]; then
Expand Down Expand Up @@ -194,13 +208,27 @@ deploy_secretless_app() {

sleep 5

sed -e "s#{{ CONJUR_VERSION }}#$CONJUR_VERSION#g" ./$PLATFORM/test-app-secretless.yml |
sed -e "s#{{ SECRETLESS_IMAGE }}#$secretless_image#g" |
sed -e "s#{{ CONJUR_AUTHN_URL }}#$conjur_authenticator_url#g" |
sed -e "s#{{ CONJUR_AUTHN_LOGIN_PREFIX }}#$conjur_authn_login_prefix#g" |
sed -e "s#{{ CONFIG_MAP_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed -e "s#{{ CONJUR_ACCOUNT }}#$CONJUR_ACCOUNT#g" |
sed -e "s#{{ CONJUR_APPLIANCE_URL }}#$conjur_appliance_url#g" |
ensure_env_database
case "${TEST_APP_DATABASE}" in
postgres)
PORT=5432
PROTOCOL=postgresql
;;
mysql)
PORT=3306
PROTOCOL=mysql
;;
esac
secretless_db_url="$PROTOCOL://localhost:$PORT/test_app"

sed "s#{{ CONJUR_VERSION }}#$CONJUR_VERSION#g" ./$PLATFORM/test-app-secretless.yml |
sed "s#{{ SECRETLESS_IMAGE }}#$secretless_image#g" |
sed "s#{{ SECRETLESS_DB_URL }}#$secretless_db_url#g" |
sed "s#{{ CONJUR_AUTHN_URL }}#$conjur_authenticator_url#g" |
sed "s#{{ CONJUR_AUTHN_LOGIN_PREFIX }}#$conjur_authn_login_prefix#g" |
sed "s#{{ CONFIG_MAP_NAME }}#$TEST_APP_NAMESPACE_NAME#g" |
sed "s#{{ CONJUR_ACCOUNT }}#$CONJUR_ACCOUNT#g" |
sed "s#{{ CONJUR_APPLIANCE_URL }}#$conjur_appliance_url#g" |
$cli create -f -

if [[ "$PLATFORM" == "openshift" ]]; then
Expand Down
23 changes: 19 additions & 4 deletions 7_verify_authentication.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ announce "Validating that the deployments are functioning as expected."

set_namespace $TEST_APP_NAMESPACE_NAME

echo "Waiting for pods to become available"

while [[ $(pods_not_ready "test-app-summon-init") ]] ||
[[ $(pods_not_ready "test-app-summon-sidecar") ]] ||
[[ $(pods_not_ready "test-app-secretless") ]]; do
printf "."
sleep 1
done
echo ""

if [[ "$PLATFORM" == "openshift" ]]; then
echo "Waiting for deployments to become available"

Expand All @@ -51,23 +61,28 @@ if [[ "$PLATFORM" == "openshift" ]]; then
init_url="localhost:8081"
sidecar_url="localhost:8082"
secretless_url="localhost:8083"

# Pause for the port-forwarding to complete setup
sleep 10
else
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
sleep 3
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
fi

echo "Waiting for urls to be ready"
until $(curl -s --connect-timeout 3 $init_url > /dev/null) &&
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's change -s to --silent, and add note that the flag doesn't silence the output, only errors and progress, so the redirection is also needed (i had to look that up).

$(curl -s --connect-timeout 3 $sidecar_url > /dev/null) &&
$(curl -s --connect-timeout 3 $secretless_url > /dev/null); do
printf "."
sleep 3
done

echo -e "\nAdding entry to the init app\n"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo -e not portable, should always use printf instead:

printf '\n%s\n' 'Adding entry to the init app'

curl \
-d '{"name": "Mr. Init"}' \
Expand Down
Loading