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

Ignore error teardown#142

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 2 commits intomasterfromignore-error-teardown
Aug 27, 2024
Merged
Show file tree
Hide file tree
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
NextNext commit
Ignore errors during teardown
  • Loading branch information
vshepard committedAug 26, 2024
commit935b2a9aab2699c6ea62d72c09e7f719fd20040f
2 changes: 1 addition & 1 deletiontestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -360,7 +360,7 @@ def _try_shutdown(self, max_attempts, with_force=False):
pass

# Check that node stopped
p_status_output = self.os_ops.exec_command(f'ps -p {node_pid}', shell=True,expect_error=True).decode('utf-8')
p_status_output = self.os_ops.exec_command(f'ps -p {node_pid}', shell=True,ignore_errors=True).decode('utf-8')
if p_status_output and str(node_pid) in p_status_output:
eprint(f'Failed to stop node {self.name}.')
else:
Expand Down
5 changes: 3 additions & 2 deletionstestgres/operations/local_ops.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -107,14 +107,15 @@ def _run_command(self, cmd, shell, input, stdin, stdout, stderr, get_process, ti
raise ExecUtilException("Command timed out after {} seconds.".format(timeout))

def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False, encoding=None, shell=False,
text=False, input=None, stdin=None, stdout=None, stderr=None, get_process=False, timeout=None):
text=False, input=None, stdin=None, stdout=None, stderr=None, get_process=False, timeout=None,
ignore_errors=False):
"""
Execute a command in a subprocess and handle the output based on the provided parameters.
"""
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(output=output, error=error)) and not expect_error:
ifnot ignore_errors and ((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:
Expand Down
4 changes: 2 additions & 2 deletionstestgres/operations/remote_ops.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ def __enter__(self):

def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
encoding=None, shell=True, text=False, input=None, stdin=None, stdout=None,
stderr=None, get_process=None, timeout=None):
stderr=None, get_process=None, timeout=None, ignore_errors=False):
"""
Execute a command in the SSH session.
Args:
Expand DownExpand Up@@ -98,7 +98,7 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
marker in error for marker in ['error', 'Permission denied', 'fatal', 'No such file or directory']
)

if error_found:
ifnot ignore_errors anderror_found:
if isinstance(error, bytes):
message = b"Utility exited with non-zero code. Error: " + error
else:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp