* debian/patches/acceptance_tests_coverage_binary.patch: Updated according to

upstream feedback.
  * debian/patches/behave_failure_logging.patch: Likewise.
  * debian/patches/acceptance_tests_postgres_port.patch: Refreshed.
  * debian/patches/acceptance_tests_system_patroni.patch: Likewise.
This commit is contained in:
Michael Banck 2019-02-08 15:45:23 +01:00
parent 7dbc251dd2
commit fbfd686a2b
5 changed files with 51 additions and 46 deletions

5
debian/changelog vendored
View file

@ -3,6 +3,11 @@ patroni (1.5.4-8) UNRELEASED; urgency=medium
[ Michael Banck ] [ Michael Banck ]
* debian/pg_createconfig_patroni: Remove debugging output and fix premature * debian/pg_createconfig_patroni: Remove debugging output and fix premature
exit. exit.
* debian/patches/acceptance_tests_coverage_binary.patch: Updated according to
upstream feedback.
* debian/patches/behave_failure_logging.patch: Likewise.
* debian/patches/acceptance_tests_postgres_port.patch: Refreshed.
* debian/patches/acceptance_tests_system_patroni.patch: Likewise.
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Thu, 07 Feb 2019 18:13:20 +0100 -- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Thu, 07 Feb 2019 18:13:20 +0100

View file

@ -1,60 +1,50 @@
--- ./features/environment.py.orig 2019-02-07 15:25:33.462976044 +0100 --- ./features/environment.py.orig 2019-02-08 10:37:57.008318346 +0100
+++ ./features/environment.py 2019-02-07 15:26:56.663869767 +0100 +++ ./features/environment.py 2019-02-08 10:39:22.654197675 +0100
@@ -1,5 +1,6 @@ @@ -11,6 +11,7 @@
import abc import signal
import datetime import six
+import distutils.spawn import subprocess
import etcd +import sys
import kazoo.client import tempfile
import kazoo.exceptions import threading
@@ -141,7 +142,12 @@ import time
@@ -141,7 +141,8 @@
if isinstance(self._context.dcs_ctl, KubernetesController): if isinstance(self._context.dcs_ctl, KubernetesController):
self._context.dcs_ctl.create_pod(self._name[8:], self._scope) self._context.dcs_ctl.create_pod(self._name[8:], self._scope)
os.environ['PATRONI_KUBERNETES_POD_IP'] = '10.0.0.' + self._name[-1] os.environ['PATRONI_KUBERNETES_POD_IP'] = '10.0.0.' + self._name[-1]
- return subprocess.Popen(['coverage', 'run', '--source=patroni', '-p', 'patroni.py', self._config], - return subprocess.Popen(['coverage', 'run', '--source=patroni', '-p', 'patroni.py', self._config],
+ + return subprocess.Popen([sys.executable, '-m', 'coverage', 'run',
+ COVERAGE_BIN = distutils.spawn.find_executable('coverage') + '--source=patroni', '-p', 'patroni.py', self._config],
+ if not COVERAGE_BIN:
+ COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage')
+
+ return subprocess.Popen([COVERAGE_BIN, 'run', '--source=patroni', '-p', 'patroni.py', self._config],
stdout=self._log, stderr=subprocess.STDOUT, cwd=self._work_directory) stdout=self._log, stderr=subprocess.STDOUT, cwd=self._work_directory)
def stop(self, kill=False, timeout=15, postgres=False): def stop(self, kill=False, timeout=15, postgres=False):
@@ -809,8 +815,13 @@ @@ -809,8 +810,8 @@
def after_all(context): def after_all(context):
context.dcs_ctl.stop() context.dcs_ctl.stop()
- subprocess.call(['coverage', 'combine']) - subprocess.call(['coverage', 'combine'])
- subprocess.call(['coverage', 'report']) - subprocess.call(['coverage', 'report'])
+ + subprocess.call([sys.executable, '-m', 'coverage', 'combine'])
+ COVERAGE_BIN = distutils.spawn.find_executable('coverage') + subprocess.call([sys.executable, '-m', 'coverage', 'report'])
+ if not COVERAGE_BIN:
+ COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage')
+
+ subprocess.call([COVERAGE_BIN, 'combine'])
+ subprocess.call([COVERAGE_BIN, 'report'])
def before_feature(context, feature): def before_feature(context, feature):
--- ./features/steps/patroni_api.py.orig 2019-02-07 15:25:36.855012350 +0100 --- ./features/steps/patroni_api.py.orig 2019-02-08 10:39:27.598301865 +0100
+++ ./features/steps/patroni_api.py 2019-02-07 15:27:30.840238671 +0100 +++ ./features/steps/patroni_api.py 2019-02-08 10:39:48.942746671 +0100
@@ -1,4 +1,5 @@ @@ -5,6 +5,7 @@
import base64 import requests
+import distutils.spawn import shlex
import json import subprocess
import os +import sys
import parse import time
@@ -95,7 +96,11 @@ import yaml
@@ -95,7 +95,7 @@
@step('I run {cmd}') @step('I run {cmd}')
def do_run(context, cmd): def do_run(context, cmd):
- cmd = ['coverage', 'run', '--source=patroni', '-p'] + shlex.split(cmd) - cmd = ['coverage', 'run', '--source=patroni', '-p'] + shlex.split(cmd)
+ COVERAGE_BIN = distutils.spawn.find_executable('coverage') + cmd = [sys.executable, '-m', 'coverage', 'run', '--source=patroni', '-p'] + shlex.split(cmd)
+ if not COVERAGE_BIN:
+ COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage')
+
+ cmd = [COVERAGE_BIN, 'run', '--source=patroni', '-p'] + shlex.split(cmd)
try: try:
# XXX: Dirty hack! We need to take name/passwd from the config! # XXX: Dirty hack! We need to take name/passwd from the config!
env = os.environ.copy() env = os.environ.copy()

View file

@ -2,7 +2,7 @@ Index: patroni/features/environment.py
=================================================================== ===================================================================
--- patroni.orig/features/environment.py --- patroni.orig/features/environment.py
+++ patroni/features/environment.py +++ patroni/features/environment.py
@@ -84,7 +84,7 @@ class AbstractController(object): @@ -83,7 +83,7 @@ class AbstractController(object):
class PatroniController(AbstractController): class PatroniController(AbstractController):

View file

@ -2,12 +2,13 @@ Index: patroni/features/environment.py
=================================================================== ===================================================================
--- patroni.orig/features/environment.py --- patroni.orig/features/environment.py
+++ patroni/features/environment.py +++ patroni/features/environment.py
@@ -147,7 +147,7 @@ class PatroniController(AbstractControll @@ -141,8 +141,7 @@ class PatroniController(AbstractControll
if not COVERAGE_BIN: if isinstance(self._context.dcs_ctl, KubernetesController):
COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage') self._context.dcs_ctl.create_pod(self._name[8:], self._scope)
os.environ['PATRONI_KUBERNETES_POD_IP'] = '10.0.0.' + self._name[-1]
- return subprocess.Popen([COVERAGE_BIN, 'run', '--source=patroni', '-p', 'patroni.py', self._config], - return subprocess.Popen([sys.executable, '-m', 'coverage', 'run',
+ return subprocess.Popen([COVERAGE_BIN, 'run', '-p', '/usr/bin/patroni', self._config], - '--source=patroni', '-p', 'patroni.py', self._config],
+ return subprocess.Popen([sys.executable, '-m', 'coverage', 'run', '-p', '/usr/bin/patroni', self._config],
stdout=self._log, stderr=subprocess.STDOUT, cwd=self._work_directory) stdout=self._log, stderr=subprocess.STDOUT, cwd=self._work_directory)
def stop(self, kill=False, timeout=15, postgres=False): def stop(self, kill=False, timeout=15, postgres=False):

View file

@ -2,9 +2,18 @@ Index: patroni/features/environment.py
=================================================================== ===================================================================
--- patroni.orig/features/environment.py --- patroni.orig/features/environment.py
+++ patroni/features/environment.py +++ patroni/features/environment.py
@@ -611,6 +611,8 @@ class PatroniPoolController(object):
feature_dir = os.path.join(self.patroni_path, 'features/output', feature_name.replace(' ', '_'))
if os.path.exists(feature_dir):
shutil.rmtree(feature_dir)
+ if os.path.exists(feature_dir + '_failed'):
+ shutil.rmtree(feature_dir + '_failed')
os.makedirs(feature_dir)
self._output_dir = feature_dir
@@ -823,3 +823,5 @@ def after_feature(context, feature): @@ -823,3 +823,5 @@ def after_feature(context, feature):
context.pctl.stop_all() context.pctl.stop_all()
shutil.rmtree(os.path.join(context.pctl.patroni_path, 'data')) shutil.rmtree(os.path.join(context.pctl.patroni_path, 'data'))
context.dcs_ctl.cleanup_service_tree() context.dcs_ctl.cleanup_service_tree()
+ if feature.status == 'failed': + if feature.status == 'failed':
+ shutil.copytree(context.pctl.output_dir, context.pctl.output_dir + "_failed") + shutil.copytree(context.pctl.output_dir, context.pctl.output_dir + '_failed')