From 874705db429de5cc23a20c5e5cb85287c163f037 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 25 Dec 2016 17:49:58 +0100 Subject: [PATCH] Configure Travis to test replication --- scripts/travis_prepare.sh | 19 ++++++++++++++++++- scripts/travis_test.sh | 6 ++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/scripts/travis_prepare.sh b/scripts/travis_prepare.sh index f4e86118..2b1e12eb 100755 --- a/scripts/travis_prepare.sh +++ b/scripts/travis_prepare.sh @@ -23,10 +23,27 @@ create () { dbname=psycopg2_test pg_createcluster -p $port --start-conf manual $version psycopg + + # for two-phase commit testing set_param "$version" max_prepared_transactions 10 + + # for replication testing + set_param "$version" max_wal_senders 5 + set_param "$version" max_replication_slots 5 + if [ "$version" == "9.2" -o "$version" == "9.3" ] + then + set_param "$version" wal_level hot_standby + else + set_param "$version" wal_level logical + fi + + echo "local replication travis trust" \ + >> "/etc/postgresql/$version/psycopg/pg_hba.conf" + + pg_ctlcluster "$version" psycopg start - sudo -u postgres psql -c "create user travis" "port=$port" + sudo -u postgres psql -c "create user travis replication" "port=$port" sudo -u postgres psql -c "create database $dbname" "port=$port" sudo -u postgres psql -c "grant create on database $dbname to travis" "port=$port" sudo -u postgres psql -c "create extension hstore" "port=$port dbname=$dbname" diff --git a/scripts/travis_test.sh b/scripts/travis_test.sh index df9413a1..15783088 100755 --- a/scripts/travis_test.sh +++ b/scripts/travis_test.sh @@ -14,11 +14,13 @@ run_test () { export PSYCOPG2_TESTDB=$dbname export PSYCOPG2_TESTDB_PORT=$port export PSYCOPG2_TESTDB_USER=travis - make check + export PSYCOPG2_TEST_REPL_DSN= + + python -c "from psycopg2 import tests; tests.unittest.main(defaultTest='tests.test_suite')" --verbose printf "\n\nRunning tests against PostgreSQL $version (green mode)\n\n" export PSYCOPG2_TEST_GREEN=1 - make check + python -c "from psycopg2 import tests; tests.unittest.main(defaultTest='tests.test_suite')" --verbose } run_test 9.6 54396