Code review, asynchronous restarts.

- Make the restart initiated by the schedule asynchronous
- Fix the placeholders in logs.
- Fix the regexp to detect the PostgreSQL version.
This commit is contained in:
Oleksii Kliukin
2016-07-12 20:25:01 +02:00
parent ec160f0d59
commit 3181c4e59f
4 changed files with 41 additions and 28 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ class MockHa(object):
return (True, '')
@staticmethod
def immediate_restart_scheduled():
def restart_scheduled():
return False
@staticmethod
@@ -120,7 +120,7 @@ class TestRestApiHandler(unittest.TestCase):
MockPatroni.dcs.cluster = None
with patch.object(RestApiHandler, 'get_postgresql_status', Mock(return_value={'role': 'master'})):
MockRestApiServer(RestApiHandler, 'GET /master')
with patch.object(MockHa, 'immediate_restart_scheduled', Mock(return_value=True)):
with patch.object(MockHa, 'restart_scheduled', Mock(return_value=True)):
MockRestApiServer(RestApiHandler, 'GET /master')
self.assertIsNotNone(MockRestApiServer(RestApiHandler, 'GET /master'))