Fixed hba configuration to test on PG 10

Use env vars instead of hardcoded PG version to select config options.
This commit is contained in:
Daniele Varrazzo 2017-04-25 13:23:44 +01:00
parent a5a5f3447a
commit 8bdba99642
2 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,7 @@ sudo: required
env:
- PGVER=10
PGTESTING=1
- PGVER=9.6
- PGVER=9.5
- PGVER=9.4

View File

@ -30,6 +30,12 @@ else
# See https://github.com/reorg/pg_repack/issues/63
sudo sed -i "s/main[[:space:]]*$/main ${PGVER}/" \
/etc/apt/sources.list.d/pgdg.list
if [ "$PGTESTING" != "" ]; then
sudo sed -i "s/trusty-pgdg/trusty-pgdg-testing/" \
/etc/apt/sources.list.d/pgdg.list
fi
sudo apt-get update
sudo apt-get install -y "libpq5=${PGVER}*" "libpq-dev=${PGVER}*"
sudo apt-mark hold libpq5
@ -45,7 +51,15 @@ sudo -u postgres mkdir -p /var/lib/postgresql/testts
sudo -u postgres "$PGBIN/psql" \
-c "create tablespace testts location '/var/lib/postgresql/testts'"
if [ $PGVER -eq "10" ]; then
# If the database was not provided by Travis it needs some customization
if [ "$PGTESTING" != "" ]; then
# Allow local connections with no password
sudo sed -i \
's/\(^local[[:space:]]\+all[[:space:]]\+all[[:space:]]\+\).*/\1trust/' \
"$CONFDIR/pg_hba.conf"
sudo -u postgres "$PGBIN/pg_ctl" -D "$DATADIR" reload
sudo -u postgres "$PGBIN/psql" -c "create user travis superuser"
fi