Log errors on docker run/exec failure

This commit is contained in:
Ayaz Salikhov
2025-03-25 08:46:26 +00:00
parent c135254c87
commit de998c41eb
2 changed files with 17 additions and 6 deletions

View File

@@ -47,6 +47,9 @@ class DockerRunner:
exec_result = container.exec_run(cmd)
output = exec_result.output.decode().rstrip()
assert isinstance(output, str)
LOGGER.debug(f"Command output: {output}")
assert exec_result.exit_code == 0, f"Command: `{cmd}` failed"
if exec_result.exit_code != 0:
LOGGER.error(f"Command output:\n{output}")
raise AssertionError(f"Command: `{cmd}` failed")
else:
LOGGER.debug(f"Command output:\n{output}")
return output