forked from michelp/pgsodium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·35 lines (27 loc) · 959 Bytes
/
test.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
#!/bin/bash
set -e
versions=${1:-13 14 15 16}
for version in $versions
do
for config in '-c shared_preload_libraries=pgsodium' '-c shared_preload_libraries=pgsodium -c pgsodium.getkey_script=/getkey' ''
do
DB_HOST="pgsodium-test-db-$version"
DB_NAME="postgres"
SU="postgres"
EXEC="docker exec -i $DB_HOST"
TAG="pgsodium/test-$version"
echo building test image $DB_HOST
docker build . -t $TAG --build-arg "version=$version"
echo running test container
docker run --rm -e POSTGRES_HOST_AUTH_METHOD=trust -d \
-v `pwd`/test:/home/postgres/pgsodium/test:Z \
-v `pwd`/example:/home/postgres/pgsodium/example:Z \
--name "$DB_HOST" $TAG postgres $config
echo waiting for database to accept connections
sleep 3;
echo running tests
$EXEC pg_prove -U "$SU" /home/postgres/pgsodium/test/test.sql
echo destroying test container and image
docker rm --force "$DB_HOST"
done
done