2016-01-15 21:33:30 +03:00
|
|
|
#!/bin/bash
|
2016-11-04 04:05:50 +03:00
|
|
|
#
|
|
|
|
# Integartion testing with dockerized Postgres servers
|
|
|
|
#
|
|
|
|
# Requires Docker for Mac to run on OSX.
|
|
|
|
# Install: https://docs.docker.com/engine/installation/mac/
|
|
|
|
#
|
2016-01-15 21:33:30 +03:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2016-11-04 04:05:50 +03:00
|
|
|
export PGHOST=${PGHOST:-localhost}
|
2016-01-15 21:33:30 +03:00
|
|
|
export PGUSER="postgres"
|
2020-03-16 04:54:17 +03:00
|
|
|
export PGPASSWORD="ci"
|
2016-01-15 21:33:30 +03:00
|
|
|
export PGDATABASE="booktown"
|
2016-01-15 21:44:21 +03:00
|
|
|
export PGPORT="15432"
|
2016-01-15 21:33:30 +03:00
|
|
|
|
2018-03-01 07:33:14 +03:00
|
|
|
# TODO: Enable the 10.x branch when it's supported on Travis.
|
|
|
|
# Local 10.x version is required so that pg_dump can properly work with older versions.
|
|
|
|
# 10.x branch is normally supported.
|
|
|
|
versions="9.1 9.2 9.3 9.4 9.5 9.6"
|
2018-02-22 23:20:18 +03:00
|
|
|
|
|
|
|
for i in $versions
|
2016-01-15 21:33:30 +03:00
|
|
|
do
|
2018-02-22 23:20:18 +03:00
|
|
|
export PGVERSION="$i"
|
2016-11-04 04:05:50 +03:00
|
|
|
|
2018-02-22 23:20:18 +03:00
|
|
|
echo "------------------------------- BEGIN TEST -------------------------------"
|
2016-01-15 21:33:30 +03:00
|
|
|
echo "Running tests against PostgreSQL v$PGVERSION"
|
|
|
|
docker rm -f postgres || true
|
2016-01-15 21:44:21 +03:00
|
|
|
docker run -p $PGPORT:5432 --name postgres -e POSTGRES_PASSWORD=$PGPASSWORD -d postgres:$PGVERSION
|
2016-01-15 21:33:30 +03:00
|
|
|
sleep 5
|
|
|
|
make test
|
2018-02-22 23:20:18 +03:00
|
|
|
echo "-------------------------------- END TEST --------------------------------"
|
2018-06-06 02:20:58 +03:00
|
|
|
done
|
|
|
|
|