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

Add expect_error to pg_upgrade#134

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

Open
demonolock wants to merge1 commit intomaster
base:master
Choose a base branch
Loading
frompg-upgrade-expect-error
Open
Show file tree
Hide file tree
Changes fromall commits
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
5 changes: 3 additions & 2 deletionstestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1627,7 +1627,7 @@ def set_auto_conf(self, options, config='postgresql.auto.conf', rm_options={}):

self.os_ops.write(path, auto_conf, truncate=True)

def upgrade_from(self, old_node, options=None):
def upgrade_from(self, old_node, options=None, expect_error=False):
"""
Upgrade this node from an old node using pg_upgrade.

Expand DownExpand Up@@ -1656,10 +1656,11 @@ def upgrade_from(self, old_node, options=None):
"--new-datadir", self.data_dir,
"--old-port", str(old_node.port),
"--new-port", str(self.port),
"--copy"
]
upgrade_command += options

return self.os_ops.exec_command(upgrade_command)
return self.os_ops.exec_command(upgrade_command, expect_error=expect_error)

def _get_bin_path(self, filename):
if self.bin_dir:
Expand Down
13 changes: 9 additions & 4 deletionstestgres/operations/local_ops.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,13 +19,18 @@

CMD_TIMEOUT_SEC = 60
error_markers = [b'error', b'Permission denied', b'fatal']
err_out_markers = [b'Failure']


def has_errors(output):
def has_errors(output=None, error=None):
if output:
if isinstance(output, str):
output = output.encode(get_default_encoding())
return any(marker in output for marker in error_markers)
return any(marker in output for marker in err_out_markers)
if error:
if isinstance(error, str):
error = error.encode(get_default_encoding())
return any(marker in error for marker in error_markers)
return False


Expand DownExpand Up@@ -107,8 +112,8 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
process, output, error = self._run_command(cmd, shell, input, stdin, stdout, stderr, get_process, timeout, encoding)
if get_process:
return process
if process.returncode != 0 or(has_errors(error) and not expect_error):
self._raise_exec_exception('Utility exited with non-zero code. Error `{}`', cmd, process.returncode, error)
if(process.returncode != 0 or has_errors(output=output,error=error)) and not expect_error:
self._raise_exec_exception('Utility exited with non-zero code. Error `{}`', cmd, process.returncode, error or output)

if verbose:
return process.returncode, output, error
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp