From e79c9c234aa3a8e2d98e4970292aee63adf4572a Mon Sep 17 00:00:00 2001 From: Lukasz Nowak <luke@nexedi.com> Date: Mon, 9 Jul 2018 11:19:17 +0200 Subject: [PATCH] caddy-frontend: Trim down SlapOS log on error In case of error during processing SlapOS software or instance expose last 100 lines of the message, which is enough to identify the problem and does not clutter the test master. --- software/caddy-frontend/test/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/software/caddy-frontend/test/utils.py b/software/caddy-frontend/test/utils.py index a254738a9a..a58cfac3cd 100644 --- a/software/caddy-frontend/test/utils.py +++ b/software/caddy-frontend/test/utils.py @@ -177,7 +177,8 @@ class SlapOSInstanceTestCase(unittest.TestCase): cls.config, environment=os.environ) stream.seek(0) stream.flush() - assert cls.software_status_dict['status_code'] == 0, stream.read() + message = ''.join(stream.readlines()[-100:]) + assert cls.software_status_dict['status_code'] == 0, message finally: logger.removeHandler(stream_handler) del stream @@ -198,7 +199,8 @@ class SlapOSInstanceTestCase(unittest.TestCase): environment=os.environ) stream.seek(0) stream.flush() - assert cls.instance_status_dict['status_code'] == 0, stream.read() + message = ''.join(stream.readlines()[-100:]) + assert cls.instance_status_dict['status_code'] == 0, message finally: logger.removeHandler(stream_handler) del stream -- 2.30.9