Files
patroni/.github/workflows/run_tests.py
T
Alexander KukushkinandGitHub f3420e2db5 Compatibility with PostgreSQL 14 (#1926)
PostgreSQL 14 changed the behavior of replicas when certain parameters (like for example `max_connections`) are changed (increased): https://github.com/postgres/postgres/commit/15251c0a.
Instead of immediately exiting Postgres 14 pauses replication and waits for actions from the operator.

Since the `pg_is_wal_replay_paused()` returning `True` is the only indicator of such a change, Patroni on the replica will call the `pg_wal_replay_resume()`, which would cause either continue replication or shutdown (like previously).

So far Patroni was never calling `pg_wal_replay_resume()` on its own, therefore, to remain backward compatible it will call it only for PostgreSQL 14+.
2021-06-25 13:41:45 +02:00

51 lines
1.7 KiB
Python

import os
import shutil
import subprocess
import sys
import tempfile
def main():
what = os.environ.get('DCS', sys.argv[1] if len(sys.argv) > 1 else 'all')
if what == 'all':
flake8 = subprocess.call([sys.executable, 'setup.py', 'flake8'])
test = subprocess.call([sys.executable, 'setup.py', 'test'])
version = '.'.join(map(str, sys.version_info[:2]))
shutil.move('.coverage', os.path.join(tempfile.gettempdir(), '.coverage.' + version))
return flake8 | test
elif what == 'combine':
tmp = tempfile.gettempdir()
for name in os.listdir(tmp):
if name.startswith('.coverage.'):
shutil.move(os.path.join(tmp, name), name)
return subprocess.call([sys.executable, '-m', 'coverage', 'combine'])
env = os.environ.copy()
if sys.platform.startswith('linux'):
from mapping import versions
version = versions.get(what)
path = '/usr/lib/postgresql/{0}/bin:.'.format(version)
unbuffer = ['timeout', '600', 'unbuffer']
args = ['--tags=-skip'] if what == 'etcd' else []
else:
path = os.path.abspath(os.path.join('pgsql', 'bin'))
if sys.platform == 'darwin':
path += ':.'
args = unbuffer = []
env['PATH'] = path + os.pathsep + env['PATH']
env['DCS'] = what
ret = subprocess.call(unbuffer + [sys.executable, '-m', 'behave'] + args, env=env)
if ret != 0:
if subprocess.call('grep . features/output/*_failed/*postgres?.*', shell=True) != 0:
subprocess.call('grep . features/output/*/*postgres?.*', shell=True)
return 1
return 0
if __name__ == '__main__':
sys.exit(main())