add timeout parameter to wait-for-it script; refs DE-347
this parameter is added for easier testing of postgres spin up timeouts. flag=none test plan: * wait-for-it still behaves as expected and defaults to 60 seconds. Change-Id: Iec8c704f68bf36941ffea043ed5c942b3e70d758 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251499 Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Kyle Rosenbaum <krosenbaum@instructure.com> Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
This commit is contained in:
parent
048ec11b63
commit
d123b00089
|
@ -3,10 +3,13 @@
|
|||
set -x
|
||||
|
||||
ip_address=$(hostname -i)
|
||||
echo Attempting connection to postgres...
|
||||
for _ in {1..60}; do
|
||||
timeout=${1:-60}
|
||||
|
||||
echo Attempting connection to Postgres for $timeout seconds...
|
||||
for _ in $(seq 1 $timeout); do
|
||||
gosu postgres pg_isready --host="$ip_address" && echo "Postgres connected!" && exit
|
||||
sleep 1
|
||||
done
|
||||
echo Postgres is still down after 60 seconds.
|
||||
|
||||
echo Postgres is still down after $timeout seconds.
|
||||
exit 1
|
||||
|
|
Loading…
Reference in New Issue