Enable RAFT support and add python3-pysyncobj to dep alternatives.

This commit is contained in:
Christoph Berg 2022-11-11 12:12:53 +01:00
parent c8548c1499
commit 80f2dfcc3f
7 changed files with 29 additions and 112 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
patroni (2.1.4-3) UNRELEASED; urgency=medium
* Enable RAFT support and add python3-pysyncobj to dep alternatives.
-- Christoph Berg <myon@debian.org> Fri, 11 Nov 2022 12:10:03 +0100
patroni (2.1.4-2) unstable; urgency=medium
* Team upload.

2
debian/control vendored
View file

@ -48,7 +48,7 @@ Package: patroni
Architecture: all
Depends: ${misc:Depends}, ${python3:Depends}, lsb-base (>= 3.0-6), python3-psycopg2,
python3-etcd (>= 0.4.3) | python3-consul (>= 0.7.0) | python3-kazoo |
python3-kubernetes, python3-cdiff
python3-kubernetes | python3-pysyncobj, python3-cdiff
Recommends: iproute2
Suggests: postgresql, etcd-server | consul | zookeeperd, vip-manager, haproxy, patroni-doc
Description: PostgreSQL High Availability with ZooKeeper, etcd, Consul, or Kubernetes

View file

@ -1,102 +0,0 @@
Index: patroni/patroni/validator.py
===================================================================
--- patroni.orig/patroni/validator.py
+++ patroni/patroni/validator.py
@@ -341,13 +341,6 @@ schema = Schema({
"port": lambda i: assert_(int(i) <= 65535),
Optional("pool_interval"): int
},
- "raft": {
- "self_addr": validate_connect_address,
- Optional("bind_addr"): validate_host_port_listen,
- "partner_addrs": validate_host_port_list,
- Optional("data_dir"): str,
- Optional("password"): str
- },
"zookeeper": {
"hosts": Or(comma_separated_host_port, [validate_host_port]),
},
Index: patroni/tests/test_validator.py
===================================================================
--- patroni.orig/tests/test_validator.py
+++ patroni/tests/test_validator.py
@@ -41,13 +41,6 @@ config = {
"port": 4000,
"pool_interval": 1000
},
- "raft": {
- "self_addr": "127.0.0.1:2222",
- "bind_addr": "0.0.0.0:2222",
- "partner_addrs": ["127.0.0.1:2223", "127.0.0.1:2224"],
- "data_dir": "/",
- "password": "12345"
- },
"zookeeper": {
"hosts": "127.0.0.1:3379,127.0.0.1:3380"
},
@@ -149,7 +142,7 @@ class TestValidator(unittest.TestCase):
def test_complete_config(self, mock_out, mock_err):
schema(config)
output = mock_out.getvalue()
- self.assertEqual(['postgresql.bin_dir', 'raft.bind_addr', 'raft.self_addr'], parse_output(output))
+ self.assertEqual(['postgresql.bin_dir'], parse_output(output))
def test_bin_dir_is_file(self, mock_out, mock_err):
files.append(config["postgresql"]["data_dir"])
@@ -161,8 +154,7 @@ class TestValidator(unittest.TestCase):
schema(c)
output = mock_out.getvalue()
self.assertEqual(['etcd.hosts.1', 'etcd.hosts.2', 'kubernetes.pod_ip', 'postgresql.bin_dir',
- 'postgresql.data_dir', 'raft.bind_addr', 'raft.self_addr',
- 'restapi.connect_address'], parse_output(output))
+ 'postgresql.data_dir', 'restapi.connect_address'], parse_output(output))
@patch('socket.inet_pton', Mock(), create=True)
def test_bin_dir_is_empty(self, mock_out, mock_err):
@@ -178,8 +170,8 @@ class TestValidator(unittest.TestCase):
with patch('patroni.validator.open', mock_open(read_data='9')):
schema(c)
output = mock_out.getvalue()
- self.assertEqual(['consul.host', 'etcd.host', 'postgresql.bin_dir', 'postgresql.data_dir', 'postgresql.listen',
- 'raft.bind_addr', 'raft.self_addr', 'restapi.connect_address'], parse_output(output))
+ self.assertEqual(['consul.host', 'etcd.host', 'postgresql.bin_dir', 'postgresql.data_dir',
+ 'postgresql.listen', 'restapi.connect_address'], parse_output(output))
@patch('subprocess.check_output', Mock(return_value=b"postgres (PostgreSQL) 12.1"))
def test_data_dir_contains_pg_version(self, mock_out, mock_err):
@@ -197,7 +189,7 @@ class TestValidator(unittest.TestCase):
with patch('patroni.validator.open', mock_open(read_data='12')):
schema(config)
output = mock_out.getvalue()
- self.assertEqual(['raft.bind_addr', 'raft.self_addr'], parse_output(output))
+ self.assertEqual([], parse_output(output))
@patch('subprocess.check_output', Mock(return_value=b"postgres (PostgreSQL) 12.1"))
def test_pg_version_missmatch(self, mock_out, mock_err):
@@ -212,8 +204,7 @@ class TestValidator(unittest.TestCase):
with patch('patroni.validator.open', mock_open(read_data='11')):
schema(c)
output = mock_out.getvalue()
- self.assertEqual(['etcd.hosts', 'postgresql.data_dir',
- 'raft.bind_addr', 'raft.self_addr'], parse_output(output))
+ self.assertEqual(['etcd.hosts', 'postgresql.data_dir'], parse_output(output))
@patch('subprocess.check_output', Mock(return_value=b"postgres (PostgreSQL) 12.1"))
def test_pg_wal_doesnt_exist(self, mock_out, mock_err):
@@ -226,7 +217,7 @@ class TestValidator(unittest.TestCase):
with patch('patroni.validator.open', mock_open(read_data='11')):
schema(c)
output = mock_out.getvalue()
- self.assertEqual(['postgresql.data_dir', 'raft.bind_addr', 'raft.self_addr'], parse_output(output))
+ self.assertEqual(['postgresql.data_dir'], parse_output(output))
def test_data_dir_is_empty_string(self, mock_out, mock_err):
directories.append(config["postgresql"]["data_dir"])
@@ -238,5 +229,5 @@ class TestValidator(unittest.TestCase):
c["postgresql"]["bin_dir"] = ""
schema(c)
output = mock_out.getvalue()
- self.assertEqual(['kubernetes', 'postgresql.bin_dir', 'postgresql.data_dir',
- 'postgresql.pg_hba', 'raft.bind_addr', 'raft.self_addr'], parse_output(output))
+ self.assertEqual(['kubernetes', 'postgresql.bin_dir',
+ 'postgresql.data_dir', 'postgresql.pg_hba'], parse_output(output))

View file

@ -3,6 +3,5 @@ acceptance_tests_system_patroni.patch
requirements_setuptools.patch
offline_intersphinx.patch
requirements_cdiff.patch
regression_tests_disable_raft_tests.py
avoid_overwriting_configuration_during_boostrap.patch
acceptance_tests_speedup.patch

View file

@ -52,9 +52,15 @@ for PG_VERSION in $(ls -1r /usr/lib/postgresql/); do
else
SKIP=
fi
$SU "set -o pipefail; ETCD_UNSUPPORTED_ARCH=$ETCD_ARCH DCS=$DCS \
if ! $SU "set -o pipefail; ETCD_UNSUPPORTED_ARCH=$ETCD_ARCH DCS=$DCS \
PATH=/usr/lib/postgresql/${PG_VERSION}/bin:$PATH \
behave ${SKIP} $@ | ts" || \
(for file in $(ls features/output/*_failed/*); do echo "$file:"; cat $file; done && exit 1)
echo "### End $PG_VERSION acceptance-$DCS ###"
behave ${SKIP} $@ | ts"; then
for file in features/output/*_failed/*; do
case $file in *.journal*) continue ;; esac # skip RAFT journal files
echo "$file:"
cat $file
done
exit 1
fi
echo "### End $PG_VERSION acceptance-$DCS $@ ###"
done

12
debian/tests/control vendored
View file

@ -49,6 +49,18 @@ Depends:
Test-Command: debian/tests/acceptance zookeeper
Restrictions: needs-root, allow-stderr, flaky, skip-not-installable
# raft
Features: test-name=acceptance-raft
Depends:
moreutils,
postgresql,
python3-behave,
python3-coverage,
python3-pysyncobj,
@,
Test-Command: debian/tests/acceptance raft
Restrictions: allow-stderr, flaky
# regression tests
Depends:
python3-boto3,

4
debian/tests/test vendored
View file

@ -9,8 +9,4 @@ export TZ=UTC # suppress UnknownTimeZoneError('Etc/UTC',)
# clean up afterwards
trap 'rm -f /tmp/pgpass?' 0 2 3 15
# remove raft tests for now
rm -f tests/test_raft*py
rm -f patroni/dcs/raft.py patroni/raft_controller.py
python3 setup.py test