mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Attempt to export acceptance tests coverage results to coveralls
This commit is contained in:
+6
-5
@@ -3,7 +3,8 @@ language: python
|
||||
addons:
|
||||
postgresql: "9.5"
|
||||
env:
|
||||
- BOTO_CONFIG='' ETCDVERSION=2.2.5
|
||||
- TEST_SUITE="python setup.py test"
|
||||
- TEST_SUITE="behave"
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.4"
|
||||
@@ -19,12 +20,12 @@ install:
|
||||
- sudo /etc/init.d/postgresql stop
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then pip install -r requirements-py2.txt --use-mirrors; fi
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install -r requirements-py3.txt; fi
|
||||
- curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etcd-v${ETCDVERSION}-linux-amd64.tar.gz | tar xz -C . --strip=1 --wildcards --no-anchored etcd
|
||||
- pip install behave coveralls codacy-coverage
|
||||
- ETCDVERSION=2.2.5 curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etcd-v${ETCDVERSION}-linux-amd64.tar.gz | tar xz -C . --strip=1 --wildcards --no-anchored etcd
|
||||
- pip install behave codacy-coverage coverage coveralls
|
||||
script:
|
||||
- python setup.py test
|
||||
- BOTO_CONFIG='' PATH=.:$PATH $TEST_SUITE
|
||||
- python setup.py flake8
|
||||
- PATH=.:$PATH behave
|
||||
after_success:
|
||||
- coveralls
|
||||
- python-codacy-coverage -r coverage.xml
|
||||
- if [[ -f coverage.xml ]]; then python-codacy-coverage -r coverage.xml; fi
|
||||
|
||||
@@ -3,9 +3,10 @@ Feature: basic replication
|
||||
|
||||
Scenario: check replication of a single table
|
||||
Given I start postgres0
|
||||
And postgres0 is a leader after 10 seconds
|
||||
And I start postgres1
|
||||
When I add the table foo to postgres0
|
||||
Then table foo is present on postgres1 after 10 seconds
|
||||
Then table foo is present on postgres1 after 15 seconds
|
||||
|
||||
Scenario: check the basic failover
|
||||
When I kill postgres0
|
||||
|
||||
@@ -3,6 +3,7 @@ Feature: cascading replication
|
||||
|
||||
Scenario: check a base backup from the replica
|
||||
Given I start postgres0
|
||||
And postgres0 is a leader after 10 seconds
|
||||
And I start postgres1
|
||||
And replication works from postgres0 to postgres1 after 15 seconds
|
||||
And I create label with "postgres0" in postgres0 data directory
|
||||
|
||||
@@ -59,7 +59,7 @@ class PatroniController(object):
|
||||
|
||||
self._config[pg_name] = self._make_patroni_test_config(pg_name, tags=tags)
|
||||
|
||||
p = subprocess.Popen(['python', 'patroni.py', self._config[pg_name]],
|
||||
p = subprocess.Popen(['coverage', 'run', '--branch', '--source=patroni', '-p', 'patroni.py', self._config[pg_name]],
|
||||
stdout=self._log[pg_name], stderr=subprocess.STDOUT, cwd=cwd)
|
||||
if not (p and p.pid and p.poll() is None):
|
||||
assert False, "PostgreSQL {0} is not running after being started".format(pg_name)
|
||||
@@ -190,6 +190,7 @@ class PatroniController(object):
|
||||
|
||||
|
||||
class EtcdController(object):
|
||||
|
||||
""" handles all etcd related tasks, used for the tests setup and cleanup """
|
||||
ETCD_VERSION_URL = 'http://127.0.0.1:2379/version'
|
||||
ETCD_CLEANUP_URL = 'http://127.0.0.1:2379/v2/keys/service/batman?recursive=true'
|
||||
@@ -300,3 +301,5 @@ def after_feature(context, feature):
|
||||
context.pctl.stop_all()
|
||||
shutil.rmtree(os.path.join(context.pctl.patroni_path, 'data'))
|
||||
context.etcd_ctl.cleanup_service_tree()
|
||||
subprocess.call(['coverage', 'combine'])
|
||||
subprocess.call(['coverage', 'report'])
|
||||
|
||||
Reference in New Issue
Block a user