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

Pbckp 137 vs move pg node#76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
demonolock merged 6 commits intomasterfromPBCKP-137-vs-move-pg-node
May 3, 2023
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
PBCKP-137 update node
  • Loading branch information
v.shepard committedApr 17, 2023
commit8be1b3a72cecd7dd15862c3258b97fb5834e6737
18 changes: 11 additions & 7 deletionstestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -105,7 +105,6 @@
InternalError = pglib.InternalError
ProgrammingError = pglib.ProgrammingError
OperationalError = pglib.OperationalError
DatabaseError = pglib.DatabaseError


class ProcessProxy(object):
Expand DownExpand Up@@ -653,7 +652,7 @@ def get_control_data(self):

return out_dict

def slow_start(self, replica=False, dbname='template1', username='dev'):
def slow_start(self, replica=False, dbname='template1', username=default_username()):
"""
Starts the PostgreSQL instance and then polls the instance
until it reaches the expected state (primary or replica). The state is checked
Expand All@@ -673,14 +672,12 @@ def slow_start(self, replica=False, dbname='template1', username='dev'):
query = 'SELECT not pg_is_in_recovery()'
# Call poll_query_until until the expected value is returned
self.poll_query_until(query=query,
expected=False,
dbname=dbname,
username=username,
suppress={InternalError,
QueryException,
ProgrammingError,
OperationalError,
DatabaseError})
OperationalError})

def start(self, params=[], wait=True):
"""
Expand DownExpand Up@@ -970,7 +967,7 @@ def psql(self,
return process.returncode, out, err

@method_decorator(positional_args_hack(['dbname', 'query']))
def safe_psql(self, query=None, **kwargs):
def safe_psql(self, query=None,expect_error=False,**kwargs):
"""
Execute a query using psql.

Expand All@@ -980,6 +977,8 @@ def safe_psql(self, query=None, **kwargs):
dbname: database name to connect to.
username: database user name.
input: raw input to be passed.
expect_error: if True - fail if we didn't get ret
if False - fail if we got ret

**kwargs are passed to psql().

Expand All@@ -992,7 +991,12 @@ def safe_psql(self, query=None, **kwargs):

ret, out, err = self.psql(query=query, **kwargs)
if ret:
raise QueryException((err or b'').decode('utf-8'), query)
if expect_error:
out = (err or b'').decode('utf-8')
else:
raise QueryException((err or b'').decode('utf-8'), query)
elif expect_error:
assert False, f"Exception was expected, but query finished successfully: `{query}` "

return out

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp