mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Improve workflow when PGDATA is not empty during bootstrap (#1217)
Recently it has happened two times when people tried to deploy the new cluster but postgres data directory wasn't empty and also wasn't valid. In this case Patroni was still creating initialize key in DCS and trying to start the postgres up. Now it will complain about non-empty invalid postgres data directory and exit. Close https://github.com/zalando/patroni/issues/1216
This commit is contained in:
@@ -101,6 +101,7 @@ class TestPostgresql(BaseTestPostgresql):
|
||||
@patch.object(Postgresql, 'wait_for_startup')
|
||||
@patch.object(Postgresql, 'wait_for_port_open')
|
||||
@patch.object(Postgresql, 'is_running')
|
||||
@patch.object(Postgresql, 'controldata', Mock())
|
||||
def test_start(self, mock_is_running, mock_wait_for_port_open, mock_wait_for_startup, mock_popen):
|
||||
mock_is_running.return_value = MockPostmaster()
|
||||
mock_wait_for_port_open.return_value = True
|
||||
@@ -362,6 +363,7 @@ class TestPostgresql(BaseTestPostgresql):
|
||||
|
||||
@patch('os.listdir', Mock(return_value=['recovery.conf']))
|
||||
@patch('os.path.exists', Mock(return_value=True))
|
||||
@patch.object(Postgresql, 'controldata', Mock())
|
||||
def test_get_postgres_role_from_data_directory(self):
|
||||
self.assertEqual(self.p.get_postgres_role_from_data_directory(), 'replica')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user