Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit404acfb

Browse files
committed
Add wait option to start and stop functions
1 parent34fdee2 commit404acfb

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

‎testgres/node.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,13 @@ def get_control_data(self):
564564

565565
returnout_dict
566566

567-
defstart(self,params=[]):
567+
defstart(self,params=[],wait=True):
568568
"""
569569
Start this node using pg_ctl.
570570
571571
Args:
572572
params: additional arguments for pg_ctl.
573+
wait: wait until operation completes
573574
574575
Returns:
575576
This instance of :class:`.PostgresNode`.
@@ -579,7 +580,7 @@ def start(self, params=[]):
579580
get_bin_path("pg_ctl"),
580581
"-D",self.data_dir,
581582
"-l",self.pg_log_file,
582-
"-w",# wait
583+
"-w"ifwaitelse'-W',#--wait or --no-wait
583584
"start"
584585
]+params# yapf: disable
585586

@@ -594,12 +595,13 @@ def start(self, params=[]):
594595

595596
returnself
596597

597-
defstop(self,params=[]):
598+
defstop(self,params=[],wait=True):
598599
"""
599600
Stop this node using pg_ctl.
600601
601602
Args:
602603
params: additional arguments for pg_ctl.
604+
wait: wait until operation completes
603605
604606
Returns:
605607
This instance of :class:`.PostgresNode`.
@@ -608,7 +610,7 @@ def stop(self, params=[]):
608610
_params= [
609611
get_bin_path("pg_ctl"),
610612
"-D",self.data_dir,
611-
"-w",# wait
613+
"-w"ifwaitelse'-W',#--wait or --no-wait
612614
"stop"
613615
]+params# yapf: disable
614616

‎tests/test_simple.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ def test_backup_wrong_xlog_method(self):
373373
BackupException,msg='Invalid xlog_method "wrong"'):
374374
node.backup(xlog_method='wrong')
375375

376+
deftest_pg_ctl_wait_option(self):
377+
withget_new_node()asnode:
378+
node.init().start(wait=False)
379+
node.stop(wait=False)
380+
376381
deftest_replicate(self):
377382
withget_new_node()asnode:
378383
node.init(allow_streaming=True).start()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp