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

Commit1a910a2

Browse files
author
v.shepard
committed
PBCKP-137 update node
1 parent0d62e0e commit1a910a2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

‎testgres/node.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
InternalError=pglib.InternalError
106106
ProgrammingError=pglib.ProgrammingError
107107
OperationalError=pglib.OperationalError
108-
DatabaseError=pglib.DatabaseError
109108

110109

111110
classProcessProxy(object):
@@ -653,7 +652,7 @@ def get_control_data(self):
653652

654653
returnout_dict
655654

656-
defslow_start(self,replica=False,dbname='template1',username='dev'):
655+
defslow_start(self,replica=False,dbname='template1',username=default_username()):
657656
"""
658657
Starts the PostgreSQL instance and then polls the instance
659658
until it reaches the expected state (primary or replica). The state is checked
@@ -673,14 +672,12 @@ def slow_start(self, replica=False, dbname='template1', username='dev'):
673672
query='SELECT not pg_is_in_recovery()'
674673
# Call poll_query_until until the expected value is returned
675674
self.poll_query_until(query=query,
676-
expected=False,
677675
dbname=dbname,
678676
username=username,
679677
suppress={InternalError,
680678
QueryException,
681679
ProgrammingError,
682-
OperationalError,
683-
DatabaseError})
680+
OperationalError})
684681

685682
defstart(self,params=[],wait=True):
686683
"""
@@ -970,7 +967,7 @@ def psql(self,
970967
returnprocess.returncode,out,err
971968

972969
@method_decorator(positional_args_hack(['dbname','query']))
973-
defsafe_psql(self,query=None,**kwargs):
970+
defsafe_psql(self,query=None,expect_error=False,**kwargs):
974971
"""
975972
Execute a query using psql.
976973
@@ -980,6 +977,8 @@ def safe_psql(self, query=None, **kwargs):
980977
dbname: database name to connect to.
981978
username: database user name.
982979
input: raw input to be passed.
980+
expect_error: if True - fail if we didn't get ret
981+
if False - fail if we got ret
983982
984983
**kwargs are passed to psql().
985984
@@ -992,7 +991,12 @@ def safe_psql(self, query=None, **kwargs):
992991

993992
ret,out,err=self.psql(query=query,**kwargs)
994993
ifret:
995-
raiseQueryException((errorb'').decode('utf-8'),query)
994+
ifexpect_error:
995+
out= (errorb'').decode('utf-8')
996+
else:
997+
raiseQueryException((errorb'').decode('utf-8'),query)
998+
elifexpect_error:
999+
assertFalse,f"Exception was expected, but query finished successfully: `{query}` "
9961000

9971001
returnout
9981002

@@ -1139,7 +1143,8 @@ def poll_query_until(self,
11391143
elifexpectedisNone:
11401144
return# done
11411145

1142-
excepttuple(suppressor []):
1146+
excepttuple(suppressor [])ase:
1147+
print(f"Exception:{e}")
11431148
pass# we're suppressing them
11441149

11451150
time.sleep(sleep_time)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp