-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathpsql.sh
executable file
·34 lines (29 loc) · 916 Bytes
/
psql.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
version=$1
shift
DB_HOST="pgsodium-test-db-$version"
DB_NAME="postgres"
SU="postgres"
EXEC="docker exec $DB_HOST"
TAG="pgsodium/test-$version"
CONFIG="-c shared_preload_libraries=pgsodium -c pgsodium.getkey_script=/getkey"
EXPORT=6789
echo building test image $DB_HOST
docker build . -t $TAG --build-arg "version=$version"
echo running test container
docker run \
-p $EXPORT:5432 \
-v `pwd`/example:/home/postgres/pgsodium/example \
-v `pwd`/sql:/home/postgres/pgsodium/sql \
-v `pwd`/results:/home/postgres/pgsodium/results \
-v `pwd`/expected:/home/postgres/pgsodium/expected \
-e POSTGRES_HOST_AUTH_METHOD=trust \
-d --name "$DB_HOST" $TAG postgres $CONFIG
echo waiting for database to accept connections
until
$EXEC \
psql -o /dev/null -t -q -U "$SU" \
-c 'select pg_sleep(1)' \
2>/dev/null;
do sleep 1;
done
docker exec -it $DB_HOST psql -U "$SU"