From 54e59c002f9e17714cb952503e0b36da82566f96 Mon Sep 17 00:00:00 2001 From: Tristan van Berkom Date: Mon, 21 Dec 2020 17:15:38 +0900 Subject: _cas/casdprocessmanager.py: Use Messenger convinence functions. This also adjusts the very strange tests in tests/internals/cascache.py which use unittest's MagicMock interface to inspect what happened on specific python methods instead of doing proper end-to-end testing. --- src/buildstream/_cas/casdprocessmanager.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/buildstream/_cas/casdprocessmanager.py b/src/buildstream/_cas/casdprocessmanager.py index 20ff610eb..11a16f2cb 100644 --- a/src/buildstream/_cas/casdprocessmanager.py +++ b/src/buildstream/_cas/casdprocessmanager.py @@ -37,7 +37,6 @@ from .._protos.google.bytestream import bytestream_pb2_grpc from .. import _signals, utils from .._exceptions import CASCacheError -from .._message import Message, MessageType _CASD_MAX_LOGFILES = 10 _CASD_TIMEOUT = 300 # in seconds @@ -179,13 +178,8 @@ class CASDProcessManager: # buildbox-casd is already dead if messenger: - messenger.message( - Message( - MessageType.BUG, - "Buildbox-casd died during the run. Exit code: {}, Logs: {}".format( - return_code, self._logfile - ), - ) + messenger.bug( + "Buildbox-casd died during the run. Exit code: {}, Logs: {}".format(return_code, self._logfile) ) return @@ -207,17 +201,12 @@ class CASDProcessManager: self.process.wait(timeout=15) if messenger: - messenger.message( - Message(MessageType.WARN, "Buildbox-casd didn't exit in time and has been killed") - ) + messenger.warn("Buildbox-casd didn't exit in time and has been killed") return if return_code != 0 and messenger: - messenger.message( - Message( - MessageType.BUG, - "Buildbox-casd didn't exit cleanly. Exit code: {}, Logs: {}".format(return_code, self._logfile), - ) + messenger.bug( + "Buildbox-casd didn't exit cleanly. Exit code: {}, Logs: {}".format(return_code, self._logfile) ) # create_channel(): -- cgit v1.2.1