Don't let replica restore initialize key when DCS was wiped (#2970)

It was happening from the branch where Patroni was supposed to be complain about converting standalone PG cluster to be governed by Patroni and exit.
This commit is contained in:
Alexander Kukushkin
2023-12-05 08:30:20 +01:00
committed by GitHub
parent 6976939f09
commit 0e6a2ff3a9
2 changed files with 7 additions and 3 deletions
+5
View File
@@ -1585,6 +1585,11 @@ class TestHa(PostgresInit):
self.p.is_primary = false
self.ha.run_cycle()
exit_mock.assert_called_once_with(1)
self.p.set_role('replica')
self.ha.dcs.initialize = Mock()
with patch.object(Postgresql, 'cb_called', PropertyMock(return_value=True)):
self.assertEqual(self.ha.run_cycle(), 'promoted self to leader by acquiring session lock')
self.ha.dcs.initialize.assert_not_called()
@patch.object(Cluster, 'is_unlocked', Mock(return_value=False))
def test_after_pause(self):