From fbfd686a2ba0e60b81b1f4be9fb2b1f88666263b Mon Sep 17 00:00:00 2001 From: Michael Banck Date: Fri, 8 Feb 2019 15:45:23 +0100 Subject: [PATCH] * 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/changelog | 5 ++ .../acceptance_tests_coverage_binary.patch | 66 ++++++++----------- .../acceptance_tests_postgres_port.patch | 2 +- .../acceptance_tests_system_patroni.patch | 13 ++-- debian/patches/behave_failure_logging.patch | 11 +++- 5 files changed, 51 insertions(+), 46 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1556b68..abcdce8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,11 @@ patroni (1.5.4-8) UNRELEASED; urgency=medium [ Michael Banck ] * debian/pg_createconfig_patroni: Remove debugging output and fix premature 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 Thu, 07 Feb 2019 18:13:20 +0100 diff --git a/debian/patches/acceptance_tests_coverage_binary.patch b/debian/patches/acceptance_tests_coverage_binary.patch index d8b2ee9..76cbfc9 100644 --- a/debian/patches/acceptance_tests_coverage_binary.patch +++ b/debian/patches/acceptance_tests_coverage_binary.patch @@ -1,60 +1,50 @@ ---- ./features/environment.py.orig 2019-02-07 15:25:33.462976044 +0100 -+++ ./features/environment.py 2019-02-07 15:26:56.663869767 +0100 -@@ -1,5 +1,6 @@ - import abc - import datetime -+import distutils.spawn - import etcd - import kazoo.client - import kazoo.exceptions -@@ -141,7 +142,12 @@ +--- ./features/environment.py.orig 2019-02-08 10:37:57.008318346 +0100 ++++ ./features/environment.py 2019-02-08 10:39:22.654197675 +0100 +@@ -11,6 +11,7 @@ + import signal + import six + import subprocess ++import sys + import tempfile + import threading + import time +@@ -141,7 +141,8 @@ if isinstance(self._context.dcs_ctl, KubernetesController): 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', 'run', '--source=patroni', '-p', 'patroni.py', self._config], -+ -+ COVERAGE_BIN = distutils.spawn.find_executable('coverage') -+ 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], ++ return subprocess.Popen([sys.executable, '-m', 'coverage', 'run', ++ '--source=patroni', '-p', 'patroni.py', self._config], stdout=self._log, stderr=subprocess.STDOUT, cwd=self._work_directory) def stop(self, kill=False, timeout=15, postgres=False): -@@ -809,8 +815,13 @@ +@@ -809,8 +810,8 @@ def after_all(context): context.dcs_ctl.stop() - subprocess.call(['coverage', 'combine']) - subprocess.call(['coverage', 'report']) -+ -+ COVERAGE_BIN = distutils.spawn.find_executable('coverage') -+ if not COVERAGE_BIN: -+ COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage') -+ -+ subprocess.call([COVERAGE_BIN, 'combine']) -+ subprocess.call([COVERAGE_BIN, 'report']) ++ subprocess.call([sys.executable, '-m', 'coverage', 'combine']) ++ subprocess.call([sys.executable, '-m', 'coverage', 'report']) def before_feature(context, feature): ---- ./features/steps/patroni_api.py.orig 2019-02-07 15:25:36.855012350 +0100 -+++ ./features/steps/patroni_api.py 2019-02-07 15:27:30.840238671 +0100 -@@ -1,4 +1,5 @@ - import base64 -+import distutils.spawn - import json - import os - import parse -@@ -95,7 +96,11 @@ +--- ./features/steps/patroni_api.py.orig 2019-02-08 10:39:27.598301865 +0100 ++++ ./features/steps/patroni_api.py 2019-02-08 10:39:48.942746671 +0100 +@@ -5,6 +5,7 @@ + import requests + import shlex + import subprocess ++import sys + import time + import yaml + +@@ -95,7 +95,7 @@ @step('I run {cmd}') def do_run(context, cmd): - cmd = ['coverage', 'run', '--source=patroni', '-p'] + shlex.split(cmd) -+ COVERAGE_BIN = distutils.spawn.find_executable('coverage') -+ if not COVERAGE_BIN: -+ COVERAGE_BIN = distutils.spawn.find_executable('python3-coverage') -+ -+ cmd = [COVERAGE_BIN, 'run', '--source=patroni', '-p'] + shlex.split(cmd) ++ cmd = [sys.executable, '-m', 'coverage', 'run', '--source=patroni', '-p'] + shlex.split(cmd) try: # XXX: Dirty hack! We need to take name/passwd from the config! env = os.environ.copy() diff --git a/debian/patches/acceptance_tests_postgres_port.patch b/debian/patches/acceptance_tests_postgres_port.patch index 888f2e8..7d4dca8 100644 --- a/debian/patches/acceptance_tests_postgres_port.patch +++ b/debian/patches/acceptance_tests_postgres_port.patch @@ -2,7 +2,7 @@ Index: patroni/features/environment.py =================================================================== --- patroni.orig/features/environment.py +++ patroni/features/environment.py -@@ -84,7 +84,7 @@ class AbstractController(object): +@@ -83,7 +83,7 @@ class AbstractController(object): class PatroniController(AbstractController): diff --git a/debian/patches/acceptance_tests_system_patroni.patch b/debian/patches/acceptance_tests_system_patroni.patch index 8654d77..58d805b 100644 --- a/debian/patches/acceptance_tests_system_patroni.patch +++ b/debian/patches/acceptance_tests_system_patroni.patch @@ -2,12 +2,13 @@ Index: patroni/features/environment.py =================================================================== --- patroni.orig/features/environment.py +++ patroni/features/environment.py -@@ -147,7 +147,7 @@ class PatroniController(AbstractControll - 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], -+ return subprocess.Popen([COVERAGE_BIN, 'run', '-p', '/usr/bin/patroni', self._config], +@@ -141,8 +141,7 @@ class PatroniController(AbstractControll + if isinstance(self._context.dcs_ctl, KubernetesController): + 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([sys.executable, '-m', 'coverage', 'run', +- '--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) def stop(self, kill=False, timeout=15, postgres=False): diff --git a/debian/patches/behave_failure_logging.patch b/debian/patches/behave_failure_logging.patch index 062a434..8cecd2b 100644 --- a/debian/patches/behave_failure_logging.patch +++ b/debian/patches/behave_failure_logging.patch @@ -2,9 +2,18 @@ Index: patroni/features/environment.py =================================================================== --- patroni.orig/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): context.pctl.stop_all() shutil.rmtree(os.path.join(context.pctl.patroni_path, 'data')) context.dcs_ctl.cleanup_service_tree() + 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')