Skip to content

Commit 613c59c

Browse files
committed
more tests for coverage
1 parent 7be2f8d commit 613c59c

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

tests/test_simple.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ def test_custom_init(self):
5353

5454
def test_double_init(self):
5555
with get_new_node('test') as node:
56+
node.init()
57+
5658
# can't initialize node more than once
5759
with self.assertRaises(InitNodeException):
5860
node.init()
59-
node.init()
6061

6162
def test_init_after_cleanup(self):
6263
with get_new_node('test') as node:
@@ -70,6 +71,14 @@ def test_init_after_cleanup(self):
7071
node.status()
7172
node.safe_psql('postgres', 'select 1')
7273

74+
def test_double_start(self):
75+
with get_new_node('test') as node:
76+
node.init().start()
77+
78+
# can't start node more than once
79+
with self.assertRaises(StartNodeException):
80+
node.start()
81+
7382
def test_uninitialized_start(self):
7483
with get_new_node('test') as node:
7584
# node is not initialized yet
@@ -119,22 +128,13 @@ def test_psql(self):
119128

120129
def test_status(self):
121130
# check NodeStatus cast to bool
122-
condition_triggered = False
123-
if NodeStatus.Running:
124-
condition_triggered = True
125-
self.assertTrue(condition_triggered)
131+
self.assertTrue(NodeStatus.Running)
126132

127133
# check NodeStatus cast to bool
128-
condition_triggered = False
129-
if NodeStatus.Stopped:
130-
condition_triggered = True
131-
self.assertFalse(condition_triggered)
134+
self.assertFalse(NodeStatus.Stopped)
132135

133136
# check NodeStatus cast to bool
134-
condition_triggered = False
135-
if NodeStatus.Uninitialized:
136-
condition_triggered = True
137-
self.assertFalse(condition_triggered)
137+
self.assertFalse(NodeStatus.Uninitialized)
138138

139139
# check statuses after each operation
140140
with get_new_node('test') as node:
@@ -426,6 +426,10 @@ def test_logging(self):
426426
lines = log.readlines()
427427
self.assertTrue(any(node_name in s for s in lines))
428428

429+
# test logger after restart
430+
master.restart()
431+
self.assertTrue(master._logger.is_alive())
432+
429433
def test_pgbench(self):
430434
with get_new_node('node') as node:
431435
node.init().start().pgbench_init()

0 commit comments

Comments
 (0)