forked from Ada-C16/task-list-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
31 lines (24 loc) · 603 Bytes
/
test.sh
File metadata and controls
31 lines (24 loc) · 603 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# must match the name of the service for the database in
# the docker-compose.yml file
DATABASE_SERVICE=postgres
COUNTER=0
EXIT_CODE=1
SECONDS_BEFORE_TIMEOUT=59
# check to see if script is running in docker
if [ -f /.dockerenv ]; then
# spin until database is ready
while [ $EXIT_CODE -ne 0 ]
do
pg_isready -h $DATABASE_SERVICE
EXIT_CODE=$?
COUNTER=`expr $COUNTER + 1`
sleep 1
# Check for time out
if [ $COUNTER -ge $SECONDS_BEFORE_TIMEOUT ]; then
echo "Timed Out - Database not Found"
exit 1
fi
done
fi
pytest