mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Disable sudo, reshuffle travis tasks and introduce caching
Without sudo travis is executing build tasks using docker and waiting time in this case is really small, usually not longer then 10 seconds. postgresql-9.5 is installed via addons.apt.packages (without sudo) But ports 5432 and 5433 are busy. So I had to ajust environment.py to assign port from higher diapason. And a few words about build tasks: First task is used for executing unit tests for all different python versions The second one is used for executing acceptance tests against etcd The third one is used for executing acceptance tests against zookeeper acceptance tests are executed with python2.7 and python3.5 In addition that I've introduced caching of python virtual environment. It really helps to reduce time needed to install python modules.
This commit is contained in:
@@ -72,11 +72,13 @@ class AbstractController(object):
|
||||
|
||||
|
||||
class PatroniController(AbstractController):
|
||||
__PORT = 5440
|
||||
PATRONI_CONFIG = '{}.yml'
|
||||
""" starts and stops individual patronis"""
|
||||
|
||||
def __init__(self, dcs, name, work_directory, output_dir, tags=None):
|
||||
super(PatroniController, self).__init__('patroni_' + name, work_directory, output_dir)
|
||||
PatroniController.__PORT += 1
|
||||
self._data_dir = os.path.join(work_directory, 'data', name)
|
||||
self._connstring = None
|
||||
self._config = self._make_patroni_test_config(name, dcs, tags)
|
||||
@@ -109,7 +111,11 @@ class PatroniController(AbstractController):
|
||||
with open(patroni_config_name) as f:
|
||||
config = yaml.load(f)
|
||||
|
||||
self._connstring = self._make_connstring(config)
|
||||
host = config['postgresql']['listen'].split(':')[0]
|
||||
|
||||
config['postgresql']['listen'] = config['postgresql']['connect_address'] = '{0}:{1}'.format(host, self.__PORT)
|
||||
|
||||
self._connstring = 'host={0} port={1} dbname=postgres user=postgres'.format(host, self.__PORT)
|
||||
|
||||
config['postgresql'].update({'name': name, 'data_dir': self._data_dir})
|
||||
config['postgresql']['parameters'].update({
|
||||
@@ -133,11 +139,6 @@ class PatroniController(AbstractController):
|
||||
|
||||
return patroni_config_path
|
||||
|
||||
@staticmethod
|
||||
def _make_connstring(config):
|
||||
tmp = (config['postgresql']['connect_address'] + ':5432').split(':')
|
||||
return 'host={0} port={1} dbname=postgres user=postgres'.format(*tmp[:2])
|
||||
|
||||
def _connection(self):
|
||||
if not self._conn or self._conn.closed != 0:
|
||||
self._conn = psycopg2.connect(self._connstring)
|
||||
|
||||
Reference in New Issue
Block a user