From 0b1bfeca5b8aaf36bcf1e3f22bd65eb545bab3b8 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Mon, 19 Sep 2016 13:32:53 +0200 Subject: [PATCH] Make sure that we are running and testing latest versions of everything (#303) --- .travis.yml | 2 +- Dockerfile | 2 +- features/environment.py | 7 +++++-- patroni/ctl.py | 4 ++-- postgres0.yml | 2 +- postgres1.yml | 2 +- postgres2.yml | 2 +- requirements.txt | 4 ++-- tests/test_ctl.py | 6 +++--- tox.ini | 6 ------ 10 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1897ce91..20c9273b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ addons: postgresql: "9.5" env: global: - - ETCDVERSION=2.3.2 ZKVERSION=3.4.6 CONSULVERSION=0.6.4 + - ETCDVERSION=3.0.8 ZKVERSION=3.4.9 CONSULVERSION=0.7.0 matrix: - TEST_SUITE="python setup.py" - DCS="etcd" TEST_SUITE="behave" diff --git a/Dockerfile b/Dockerfile index 803c2e10..18815afb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN apt-get update -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* /root/.cache -ENV ETCDVERSION 2.3.6 +ENV ETCDVERSION 3.0.8 RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etcd-v${ETCDVERSION}-linux-amd64.tar.gz \ | tar xz -C /usr/local/bin --strip=1 --wildcards --no-anchored etcd etcdctl diff --git a/features/environment.py b/features/environment.py index be9c2f9b..3c955e5d 100644 --- a/features/environment.py +++ b/features/environment.py @@ -237,6 +237,9 @@ class ConsulController(AbstractDcsController): def cleanup_service_tree(self): self._client.kv.delete(self.path(), recurse=True) + def start(self, max_wait_limit=15): + super(ConsulController, self).start(max_wait_limit) + class EtcdController(AbstractDcsController): @@ -244,8 +247,8 @@ class EtcdController(AbstractDcsController): def __init__(self, output_dir): super(EtcdController, self).__init__('etcd', tempfile.mkdtemp(), output_dir) - os.environ['PATRONI_ETCD_HOST'] = 'localhost:4001' - self._client = etcd.Client() + os.environ['PATRONI_ETCD_HOST'] = 'localhost:2379' + self._client = etcd.Client(port=2379) def _start(self): return subprocess.Popen(["etcd", "--debug", "--data-dir", self._work_directory], diff --git a/patroni/ctl.py b/patroni/ctl.py index a57c27fb..305cb8a8 100644 --- a/patroni/ctl.py +++ b/patroni/ctl.py @@ -32,7 +32,7 @@ LOGLEVEL = 'WARNING' DCS_DEFAULTS = {'zookeeper': {'port': 2181, 'template': "zookeeper:\n hosts: ['{host}:{port}']"}, 'exhibitor': {'port': 8181, 'template': "exhibitor:\n hosts: [{host}]\n port: {port}"}, 'consul': {'port': 8500, 'template': "consul:\n host: '{host}:{port}'"}, - 'etcd': {'port': 4001, 'template': "etcd:\n host: '{host}:{port}'"}} + 'etcd': {'port': 2379, 'template': "etcd:\n host: '{host}:{port}'"}} class PatroniCtlException(ClickException): @@ -723,7 +723,7 @@ def timestamp(precision=6): @ctl.command('configure', help='Create configuration file') @click.option('--config-file', '-c', help='Configuration file', prompt='Configuration file', default=CONFIG_FILE_PATH) -@click.option('--dcs', '-d', help='The DCS connect url', prompt='DCS connect url', default='etcd://localhost:4001') +@click.option('--dcs', '-d', help='The DCS connect url', prompt='DCS connect url', default='etcd://localhost:2379') @click.option('--namespace', '-n', help='The namespace', prompt='Namespace', default='/service/') def configure(config_file, dcs, namespace): config = dict() diff --git a/postgres0.yml b/postgres0.yml index 7933eb99..818e96ef 100644 --- a/postgres0.yml +++ b/postgres0.yml @@ -12,7 +12,7 @@ restapi: # password: password etcd: - host: 127.0.0.1:4001 + host: 127.0.0.1:2379 bootstrap: # this section will be written into Etcd:///config after initializing new cluster diff --git a/postgres1.yml b/postgres1.yml index 35187a2b..090f985d 100644 --- a/postgres1.yml +++ b/postgres1.yml @@ -12,7 +12,7 @@ restapi: # password: password etcd: - host: 127.0.0.1:4001 + host: 127.0.0.1:2379 bootstrap: # this section will be written into Etcd:///config after initializing new cluster diff --git a/postgres2.yml b/postgres2.yml index 3ea34b9d..ec4a7c3a 100644 --- a/postgres2.yml +++ b/postgres2.yml @@ -12,7 +12,7 @@ restapi: password: password etcd: - host: 127.0.0.1:4001 + host: 127.0.0.1:2379 bootstrap: # this section will be written into Etcd:///config after initializing new cluster diff --git a/requirements.txt b/requirements.txt index 59e00f8e..4c4221ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,8 +5,8 @@ requests six >= 1.7 kazoo==2.2.1 python-etcd==0.4.3 -python-consul==0.6.0 +python-consul==0.6.1 click>=4.1 prettytable>=0.7 tzlocal -python-dateutil \ No newline at end of file +python-dateutil diff --git a/tests/test_ctl.py b/tests/test_ctl.py index dcdb7268..725cc7e0 100644 --- a/tests/test_ctl.py +++ b/tests/test_ctl.py @@ -31,7 +31,7 @@ def test_rw_config(): @patch('patroni.ctl.load_config', Mock(return_value={'postgresql': {'data_dir': '.', 'parameters': {}, 'retry_timeout': 5}, - 'restapi': {'auth': 'u:p', 'listen': ''}, 'etcd': {'host': 'localhost:4001'}})) + 'restapi': {'auth': 'u:p', 'listen': ''}, 'etcd': {'host': 'localhost:2379'}})) class TestCtl(unittest.TestCase): @patch('socket.getaddrinfo', socket_getaddrinfo) @@ -54,8 +54,8 @@ class TestCtl(unittest.TestCase): def test_parse_dcs(self): assert parse_dcs(None) is None - assert parse_dcs('localhost') == {'etcd': {'host': 'localhost:4001'}} - assert parse_dcs('') == {'etcd': {'host': 'localhost:4001'}} + assert parse_dcs('localhost') == {'etcd': {'host': 'localhost:2379'}} + assert parse_dcs('') == {'etcd': {'host': 'localhost:2379'}} assert parse_dcs('localhost:8500') == {'consul': {'host': 'localhost:8500'}} assert parse_dcs('zookeeper://localhost') == {'zookeeper': {'hosts': ['localhost:2181']}} assert parse_dcs('exhibitor://dummy') == {'exhibitor': {'hosts': ['dummy'], 'port': 8181}} diff --git a/tox.ini b/tox.ini index bf407bae..aa079ec5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,2 @@ [flake8] max-line-length=120 - -[testenv:py27] -deps = -rrequirements-py2.txt - -[testenv:py33] -deps = -rrequirements-py3.txt