mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-09-01 00:59:24 +00:00
Fix little bug and unit-tests
This commit is contained in:
+1
-1
@@ -146,7 +146,7 @@ def print_output(columns, rows, alignment=None, fmt='pretty', header=None, delim
|
||||
if row[i]:
|
||||
row[i] = format_config_for_editing(row[i], fmt == 'tsv').strip()
|
||||
s = int(list_cluster and fmt == 'pretty') # skip cluster name if pretty-printing
|
||||
table_data = [columns[s:]] + [row[s:] for row in rows]
|
||||
table_data = ([columns[s:]] if columns else []) + [row[s:] for row in rows]
|
||||
|
||||
if fmt == 'tsv':
|
||||
for r in table_data:
|
||||
|
||||
@@ -75,6 +75,7 @@ class MockCursor(object):
|
||||
self.closed = False
|
||||
self.rowcount = 0
|
||||
self.results = []
|
||||
self.description = []
|
||||
|
||||
def execute(self, sql, *params):
|
||||
if sql.startswith('blabla'):
|
||||
|
||||
@@ -200,9 +200,6 @@ class TestCtl(unittest.TestCase):
|
||||
rows = query_member(None, None, None, 'master', 'SELECT pg_catalog.pg_is_in_recovery()', {})
|
||||
self.assertTrue('False' in str(rows))
|
||||
|
||||
rows = query_member(None, None, None, 'replica', 'SELECT pg_catalog.pg_is_in_recovery()', {})
|
||||
self.assertEqual(rows, (None, None))
|
||||
|
||||
with patch.object(MockCursor, 'execute', Mock(side_effect=OperationalError('bla'))):
|
||||
rows = query_member(None, None, None, 'replica', 'SELECT pg_catalog.pg_is_in_recovery()', {})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user