Use configured process timeout when closing a process
Some processes get blocked waiting while they cannot read from either stdout or stderr. The command timeout was not applied when tobiko tried to close those processes. With this patch, those processes will be closed due to timeout and the tobiko retries mechanism would be able to retry the command. Change-Id: I1836de50cbbe029f7c474598ec57ea2e52822dd1
This commit is contained in:
parent
652c9696a8
commit
be26dd6b78
@ -328,7 +328,7 @@ def execute_ping(parameters, ssh_client=None, check=True):
|
|||||||
try:
|
try:
|
||||||
result = sh.execute(command=command,
|
result = sh.execute(command=command,
|
||||||
ssh_client=ssh_client,
|
ssh_client=ssh_client,
|
||||||
timeout=parameters.deadline + 2.,
|
timeout=parameters.deadline + 3.,
|
||||||
expect_exit_status=None,
|
expect_exit_status=None,
|
||||||
network_namespace=parameters.network_namespace)
|
network_namespace=parameters.network_namespace)
|
||||||
except sh.ShellError as ex:
|
except sh.ShellError as ex:
|
||||||
|
@ -197,6 +197,8 @@ class ShellProcessFixture(tobiko.SharedFixture):
|
|||||||
LOG.exception("Error closing STDERR stream: %r", self.stderr)
|
LOG.exception("Error closing STDERR stream: %r", self.stderr)
|
||||||
|
|
||||||
def close(self, timeout: tobiko.Seconds = None):
|
def close(self, timeout: tobiko.Seconds = None):
|
||||||
|
if timeout is None:
|
||||||
|
timeout = self.parameters.timeout
|
||||||
self.close_stdin()
|
self.close_stdin()
|
||||||
try:
|
try:
|
||||||
# Drain all incoming data from STDOUT and STDERR
|
# Drain all incoming data from STDOUT and STDERR
|
||||||
|
@ -413,6 +413,7 @@ def run_pcs_resource_operation(resource: str,
|
|||||||
output = execute_pcs(command_args,
|
output = execute_pcs(command_args,
|
||||||
ssh_client=ssh_client,
|
ssh_client=ssh_client,
|
||||||
add_stderr=add_stderr,
|
add_stderr=add_stderr,
|
||||||
|
timeout=operation_wait + 10.,
|
||||||
sudo=True)
|
sudo=True)
|
||||||
except sh.ShellCommandFailed as exc:
|
except sh.ShellCommandFailed as exc:
|
||||||
if attempt.is_last:
|
if attempt.is_last:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user