[continued from previous message]
+ ('Connected to Etcd node with term %d. Old known term %d. Switching to another node.',
+ 1, 2))
+ self.assertEqual(mock_logger.call_args_list[1][0], ('Etcd Cluster ID changed from %s to %s', 'a', 'b'))
+ self.client._base_uri = self.client._machines_cache[0]
+ with patch('patroni.dcs.etcd.logger.warning') as mock_logger:
+ rtry(self.client.api_execute, '/', 'POST', timeout=0, params={'retry': rtry})
+ self.assertEqual(mock_logger.call_args[0], ('Etcd Cluster ID changed from %s to %s', 'b', 'a'))
+
+ @patch('time.sleep', Mock())
@patch.object(EtcdClient, '_get_machines_list',
Mock(return_value=['
http://localhost:4001', '
http://localhost:2379']))
def test_api_execute(self):
diff -Nru patroni-4.0.5/tests/test_ha.py patroni-4.0.6/tests/test_ha.py
--- patroni-4.0.5/tests/test_ha.py 2025-02-20 16:40:20.000000000 +0100
+++ patroni-4.0.6/tests/test_ha.py 2025-06-06 19:27:48.000000000 +0200
@@ -67,7 +67,8 @@
'tags': {'clonefrom': True},
'scheduled_restart': {'schedule': "2100-01-01 10:53:07.560445+00:00",
'postgres_version': '99.0.0'}})
- syncstate = SyncState(0 if sync else None, sync and sync[0], sync and sync[1], 0)
+ syncstate = SyncState(0 if sync else None, sync and sync[0],
+ sync and sync[1], sync[2] if sync and len(sync) > 2 else 0)
failsafe = {m.name: m.api_url for m in (m1, m2)} if failsafe else None
return get_cluster(SYSID, leader, [m1, m2], failover, syncstate, cluster_config, failsafe)
@@ -509,8 +510,6 @@
def test_no_dcs_connection_primary_demote(self):
self.ha.load_cluster_from_dcs = Mock(side_effect=DCSError('Etcd is not responding properly'))
-