Skip to content

Commit 5e6f910

Browse files
committed
add pg_ctl method to PostgresNode
1 parent 725f342 commit 5e6f910

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

‎testgres/testgres.py

+11
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,17 @@ def reload(self, params=[]):
698698

699699
return self
700700

701+
def pg_ctl(self, params):
702+
"""
703+
Invoke pg_ctl with params.
704+
705+
Returns:
706+
Stdout + stderr of pg_ctl.
707+
"""
708+
709+
_params = params + ["-D", self.data_dir, "-w"]
710+
return _execute_utility("pg_ctl", _params, self.utils_logname)
711+
701712
def free_port(self):
702713
"""
703714
Reclaim port owned by this node.

‎tests/test_simple.py

+7
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,13 @@ def test_reload(self):
382382

383383
self.assertEqual(pid1, pid2)
384384

385+
def test_pg_ctl(self):
386+
with get_new_node('node') as node:
387+
node.init().start()
388+
389+
status = node.pg_ctl(['status'])
390+
self.assertTrue("server is running" in status)
391+
385392
def test_ports_management(self):
386393
# check that no ports have been bound yet
387394
self.assertEqual(len(bound_ports), 0)

0 commit comments

Comments
 (0)