Skip to content

Commit 1b4e22e

Browse files
committed
[Test] When test_createami fails, print the recent log lines rather than cloudwatch events for better readability.
1 parent 6f1cf55 commit 1b4e22e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/integration-tests/tests/createami/test_createami.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,5 +651,9 @@ def _test_build_image_failed(image):
651651
def _keep_recent_logs(image):
652652
"""Keep several lines of recent log to the console when creating an image fails."""
653653
log_stream_name = f"{get_installed_parallelcluster_base_version()}/1"
654-
failure_logs = image.get_log_events(log_stream_name, start_from_head=False, query="events[*]", limit=200)
655-
logging.info(f"Image built failed for {image.image_id}, the last 200 lines of the log are: {failure_logs}")
654+
nlines = 200
655+
log_events = image.get_log_events(log_stream_name, start_from_head=False, query="events[*]", limit=nlines)
656+
log_messages = [event["message"] for event in log_events]
657+
logging.info(
658+
f"Image built failed for {image.image_id}, the last {nlines} lines of the log are:\n" + "\n".join(log_messages)
659+
)

0 commit comments

Comments
 (0)