Skip to content

Commit 834b6c7

Browse files
committed
Error logs on error/warn in logs
1 parent de998c4 commit 834b6c7

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/utils/tracked_container.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,24 @@ def run_and_wait(
9494
assert self.container is not None
9595
rv = self.container.wait(timeout=timeout)
9696
logs = self.get_logs()
97-
failed = rv["StatusCode"] != 0
97+
rc_success = rv["StatusCode"] == 0
98+
should_report = not (
99+
no_failure == rc_success
100+
and no_warnings == (not self.get_warnings(logs))
101+
and no_errors == (not self.get_errors(logs))
102+
)
98103

99-
if failed:
104+
if not rc_success or should_report:
100105
LOGGER.error(f"Command output:\n{logs}")
101106
else:
102107
LOGGER.debug(f"Command output:\n{logs}")
103-
assert no_failure != failed
108+
self.remove()
109+
110+
# To see the reason, we run assert statements separately
111+
assert no_failure == rc_success
104112
assert no_warnings == (not self.get_warnings(logs))
105113
assert no_errors == (not self.get_errors(logs))
106-
self.remove()
114+
107115
return logs
108116

109117
@staticmethod

0 commit comments

Comments
 (0)