* debian/patches/regression_tests_psutil_compat.patch: New patch, add
compatibility for newer psutil in the regression tests (Closes: #1003562).
This commit is contained in:
parent
504752fc12
commit
b3cede2442
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -9,6 +9,8 @@ patroni (2.1.2-3) UNRELEASED; urgency=medium
|
|||
* debian/tests/test: No longer remove raft tests, no longer needed.
|
||||
* debian/patches/regression_tests_disable_raft_tests.py: Removed, no longer
|
||||
needed.
|
||||
* debian/patches/regression_tests_psutil_compat.patch: New patch, add
|
||||
compatibility for newer psutil in the regression tests (Closes: #1003562).
|
||||
|
||||
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Sun, 13 Feb 2022 15:54:41 +0100
|
||||
|
||||
|
|
96
debian/patches/regression_tests_psutil_compat.patch
vendored
Normal file
96
debian/patches/regression_tests_psutil_compat.patch
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
From 01d40a4a1384156928131aea6f93f5e2cddc90b7 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Kukushkin <cyberdemn@gmail.com>
|
||||
Date: Wed, 5 Jan 2022 09:53:33 +0100
|
||||
Subject: [PATCH] Compatibility with latest psutil and setuptools (#2155)
|
||||
|
||||
Issues don't affect Patroni code, only unit-tests
|
||||
---
|
||||
setup.py | 9 ++++-----
|
||||
tests/test_cancellable.py | 4 ++--
|
||||
tests/test_postmaster.py | 8 ++++----
|
||||
3 files changed, 10 insertions(+), 11 deletions(-)
|
||||
|
||||
Index: patroni/setup.py
|
||||
===================================================================
|
||||
--- patroni.orig/setup.py
|
||||
+++ patroni/setup.py
|
||||
@@ -5,6 +5,7 @@
|
||||
"""
|
||||
|
||||
import inspect
|
||||
+import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -132,12 +133,8 @@ class PyTest(Command):
|
||||
except Exception:
|
||||
raise RuntimeError('py.test is not installed, run: pip install pytest')
|
||||
|
||||
- import logging
|
||||
- silence = logging.WARNING
|
||||
- logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=os.getenv('LOGLEVEL', silence))
|
||||
-
|
||||
args = ['--verbose', 'tests', '--doctest-modules', MAIN_PACKAGE] +\
|
||||
- ['-s' if logging.getLogger().getEffectiveLevel() < silence else '--capture=fd']
|
||||
+ ['-s' if logging.getLogger().getEffectiveLevel() < logging.WARNING else '--capture=fd']
|
||||
if self.cov:
|
||||
args += self.cov
|
||||
|
||||
@@ -161,6 +158,8 @@ def read(fname):
|
||||
|
||||
|
||||
def setup_package(version):
|
||||
+ logging.basicConfig(format='%(message)s', level=os.getenv('LOGLEVEL', logging.WARNING))
|
||||
+
|
||||
# Assemble additional setup commands
|
||||
cmdclass = {'test': PyTest, 'flake8': Flake8}
|
||||
|
||||
Index: patroni/tests/test_cancellable.py
|
||||
===================================================================
|
||||
--- patroni.orig/tests/test_cancellable.py
|
||||
+++ patroni/tests/test_cancellable.py
|
||||
@@ -27,8 +27,8 @@ class TestCancellableSubprocess(unittest
|
||||
def test_cancel(self):
|
||||
self.c._process = Mock()
|
||||
self.c._process.is_running.return_value = True
|
||||
- self.c._process.children.side_effect = psutil.Error()
|
||||
- self.c._process.suspend.side_effect = psutil.Error()
|
||||
+ self.c._process.children.side_effect = psutil.NoSuchProcess(123)
|
||||
+ self.c._process.suspend.side_effect = psutil.AccessDenied()
|
||||
self.c.cancel()
|
||||
self.c._process.is_running.side_effect = [True, False]
|
||||
self.c.cancel()
|
||||
Index: patroni/tests/test_postmaster.py
|
||||
===================================================================
|
||||
--- patroni.orig/tests/test_postmaster.py
|
||||
+++ patroni/tests/test_postmaster.py
|
||||
@@ -73,7 +73,7 @@ class TestPostmasterProcess(unittest.Tes
|
||||
|
||||
# all processes successfully stopped
|
||||
mock_children.return_value = [Mock()]
|
||||
- mock_children.return_value[0].kill.side_effect = psutil.Error
|
||||
+ mock_children.return_value[0].kill.side_effect = psutil.NoSuchProcess(123)
|
||||
self.assertTrue(proc.signal_kill())
|
||||
|
||||
# postmaster has gone before suspend
|
||||
@@ -81,17 +81,17 @@ class TestPostmasterProcess(unittest.Tes
|
||||
self.assertTrue(proc.signal_kill())
|
||||
|
||||
# postmaster has gone before we got a list of children
|
||||
- mock_suspend.side_effect = psutil.Error()
|
||||
+ mock_suspend.side_effect = psutil.AccessDenied()
|
||||
mock_children.side_effect = psutil.NoSuchProcess(123)
|
||||
self.assertTrue(proc.signal_kill())
|
||||
|
||||
# postmaster has gone after we got a list of children
|
||||
- mock_children.side_effect = psutil.Error()
|
||||
+ mock_children.side_effect = psutil.AccessDenied()
|
||||
mock_kill.side_effect = psutil.NoSuchProcess(123)
|
||||
self.assertTrue(proc.signal_kill())
|
||||
|
||||
# failed to kill postmaster
|
||||
- mock_kill.side_effect = psutil.AccessDenied(123)
|
||||
+ mock_kill.side_effect = psutil.AccessDenied()
|
||||
self.assertFalse(proc.signal_kill())
|
||||
|
||||
@patch('psutil.Process.__init__', Mock())
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
|
@ -4,3 +4,4 @@ requirements_setuptools.patch
|
|||
offline_intersphinx.patch
|
||||
regression_tests_disable_requirement_download.patch
|
||||
requirements_cdiff.patch
|
||||
regression_tests_psutil_compat.patch
|
||||
|
|
Loading…
Reference in a new issue