Configure Travis to test replication

This commit is contained in:
Daniele Varrazzo 2016-12-25 17:49:58 +01:00
parent b73115ac41
commit 874705db42
2 changed files with 22 additions and 3 deletions

View File

@ -23,10 +23,27 @@ create () {
dbname=psycopg2_test dbname=psycopg2_test
pg_createcluster -p $port --start-conf manual $version psycopg pg_createcluster -p $port --start-conf manual $version psycopg
# for two-phase commit testing
set_param "$version" max_prepared_transactions 10 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 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 "create database $dbname" "port=$port"
sudo -u postgres psql -c "grant create on database $dbname to travis" "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" sudo -u postgres psql -c "create extension hstore" "port=$port dbname=$dbname"

View File

@ -14,11 +14,13 @@ run_test () {
export PSYCOPG2_TESTDB=$dbname export PSYCOPG2_TESTDB=$dbname
export PSYCOPG2_TESTDB_PORT=$port export PSYCOPG2_TESTDB_PORT=$port
export PSYCOPG2_TESTDB_USER=travis 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" printf "\n\nRunning tests against PostgreSQL $version (green mode)\n\n"
export PSYCOPG2_TEST_GREEN=1 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 run_test 9.6 54396