From 1f829a4b346e8a3e47b86ca9f4de55bba8613a13 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Thu, 12 Jan 2017 14:32:30 +0100 Subject: [PATCH] Switch to trusty and run acceptance tests with postgres 9.6 --- .travis.yml | 38 +++++++++++++++++++----------------- features/patroni_api.feature | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ff04786..6613e551 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,12 @@ sudo: false +dist: trusty language: python python: -- "3.5" -addons: - apt: - packages: - - postgresql-contrib-9.5 - postgresql: "9.5" +- "3.4" # 2.7 and 3.5 are preinstalled by default env: global: - - ETCDVERSION=3.0.15 ZKVERSION=3.4.9 CONSULVERSION=0.7.1 + - ETCDVERSION=3.0.15 ZKVERSION=3.4.9 CONSULVERSION=0.7.2 + - PYVERSIONS="2.7 3.4 3.5" matrix: - TEST_SUITE="python setup.py" - DCS="etcd" TEST_SUITE="behave" @@ -19,10 +16,14 @@ cache: directories: - $HOME/mycache before_cache: -- mv $HOME/virtualenv/python2.7.9 $HOME/mycache/python2.7.9 -- if [[ $TEST_SUITE != "behave" ]]; then mv $HOME/virtualenv/python3.4.2 $HOME/mycache/python3.4.2; fi -- mv $HOME/virtualenv/python3.5.2 $HOME/mycache/python3.5.2 -- rm -f $HOME/mycache/python3.5.2/python3.5.2 +- | + rm -fr $HOME/mycache/python* + for pv in $PYVERSIONS; do + if [[ $TEST_SUITE != "behave" || $pv != "3.4" ]]; then + fpv=$(basename $(readlink $HOME/virtualenv/python${pv})) + mv $HOME/virtualenv/${fpv} $HOME/mycache/${fpv} + fi + done install: - | set -e @@ -74,11 +75,12 @@ install: done fi - for pv in "2.7.9" "3.4.2" "3.5.2"; do - if [[ $TEST_SUITE != "behave" || $pv != "3.4.2" ]]; then - if [[ -d ~/mycache/python${pv} ]]; then - mv ~/virtualenv/python${pv} ~/virtualenv/python${pv}.bckp - mv ~/mycache/python${pv} ~/virtualenv/python${pv} + for pv in $PYVERSIONS; do + if [[ $TEST_SUITE != "behave" || $pv != "3.4" ]]; then + fpv=$(basename $(readlink $HOME/virtualenv/python$pv)) + if [[ -d ~/mycache/${fpv} ]]; then + mv ~/virtualenv/${fpv} ~/virtualenv/${fpv}.bckp + mv ~/mycache/${fpv} ~/virtualenv/${fpv} fi source ~/virtualenv/python${pv}/bin/activate # explicitly install all needed python modules to cache them @@ -89,7 +91,7 @@ install: done script: - | - for pv in "2.7" "3.4" "3.5"; do + for pv in $PYVERSIONS; do source ~/virtualenv/python${pv}/bin/activate if [[ $TEST_SUITE != "behave" ]]; then @@ -98,7 +100,7 @@ script: $TEST_SUITE flake8 elif [[ $pv != "3.4" ]]; then echo Running acceptance tests using python${pv} - if ! PATH=.:$PATH $TEST_SUITE; then + if ! PATH=.:/usr/lib/postgresql/9.6/bin:$PATH $TEST_SUITE; then # output all log files when tests are failing grep . features/output/*/*postgres?.* exit 1 diff --git a/features/patroni_api.feature b/features/patroni_api.feature index dfdf878b..91eb27dc 100644 --- a/features/patroni_api.feature +++ b/features/patroni_api.feature @@ -73,7 +73,7 @@ Scenario: check the failover via the API in the pause mode And replication works from postgres1 to postgres0 after 20 seconds Scenario: check the scheduled failover - Given I issue a scheduled failover from postgres1 to postgres0 in 1 seconds + Given I issue a scheduled failover from postgres1 to postgres0 in 3 seconds Then I receive a response returncode 1 And I receive a response output "Can't schedule failover in the paused state" When I run patronictl.py resume batman