mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Add pending restart reason information (#2978)
Provide info about the PG parameters that caused "pending restart" flag to be set. Both `patronictl list` and `/patroni` REST API endpoint now show the parameters names and the diff as the "pending restart reason".
This commit is contained in:
@@ -4,10 +4,11 @@ import sys
|
||||
from mock import Mock, PropertyMock, patch
|
||||
|
||||
from patroni.async_executor import CriticalTask
|
||||
from patroni.collections import CaseInsensitiveDict
|
||||
from patroni.postgresql import Postgresql
|
||||
from patroni.postgresql.bootstrap import Bootstrap
|
||||
from patroni.postgresql.cancellable import CancellableSubprocess
|
||||
from patroni.postgresql.config import ConfigHandler
|
||||
from patroni.postgresql.config import ConfigHandler, get_param_diff
|
||||
|
||||
from . import psycopg_connect, BaseTestPostgresql, mock_available_gucs
|
||||
|
||||
@@ -245,8 +246,9 @@ class TestBootstrap(BaseTestPostgresql):
|
||||
self.assertTrue(task.result)
|
||||
|
||||
self.b.bootstrap(config)
|
||||
with patch.object(Postgresql, 'pending_restart', PropertyMock(return_value=True)), \
|
||||
patch.object(Postgresql, 'restart', Mock()) as mock_restart:
|
||||
with patch.object(Postgresql, 'pending_restart_reason',
|
||||
PropertyMock(CaseInsensitiveDict({'max_connections': get_param_diff('200', '100')}))), \
|
||||
patch.object(Postgresql, 'restart', Mock()) as mock_restart:
|
||||
self.b.post_bootstrap({}, task)
|
||||
mock_restart.assert_called_once()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user