-
Notifications
You must be signed in to change notification settings - Fork 25
/
test-postgres.sh
executable file
·49 lines (41 loc) · 1.15 KB
/
test-postgres.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
PASSWORD=$(openssl rand -base64 18 | tr -d +/)
#export TZ=Asia/Kolkata
export TZ=America/Los_Angeles
run_pg_tests() {
docker pull postgres:$1
docker run -d --rm --name dbtest-pg -e TZ=$TZ -e POSTGRES_PASSWORD=$PASSWORD -p 5432:5432/tcp postgres:$1
declare -i count=1
until docker exec dbtest-pg pg_isready -U postgres -h localhost -p 5432 > /dev/null 2>&1;
do
echo "Waiting for container to start ($count seconds)"
sleep 1
count=$((count + 1))
if [ $count -gt 120 ] ; then
echo "Database did not startup correctly ($1)"
docker rm -f dbtest-pg
exit 1
fi
done
mvn -e -Dmaven.javadoc.skip=true \
-Dfailsafe.rerunFailingTestsCount=2 \
-Dpostgres.database.url=jdbc:postgresql://localhost/postgres \
-Dpostgres.database.user=postgres \
-Dpostgres.database.password=$PASSWORD \
-P postgresql.only,coverage test
if [ $? -ne 0 ] ; then
echo "mvn command failed"
docker rm -f dbtest-pg
exit 1
fi
docker rm -f dbtest-pg
}
run_pg_tests 9.6
run_pg_tests 10
run_pg_tests 11
run_pg_tests 12
run_pg_tests 13
run_pg_tests 14
run_pg_tests 15
run_pg_tests 16
run_pg_tests 17