summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-04-14 19:20:38 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-04-14 19:20:38 +0900
commit2db11763d50b2295ab49b44c5ed0adee38ad67fe (patch)
treecc946f5b1d045d719d6cbbc886f3b288ad378e97
parent573ec7caf09305e59b22cc24ba0493a40f6bc5a5 (diff)
downloadbuildstream-tristan/platform-cache-quota-1.2.tar.gz
tests/testutils/artifactshare.py: Add message handlertristan/platform-cache-quota-1.2
This needs to be added along with the status messages added to the artifact cache, and this detail diverges from master. This is because we have not bothered to backport !1071 which refactors the CASCache to be a delegate object of the ArtifactCache istead of a derived class - backporting !1071 would allow us to remove these message handlers because the CAS server and test fixture only use the CASCache object directly, not the business logic in the ArtifactCache.
-rw-r--r--tests/testutils/artifactshare.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index 71aac534b..c7987e02c 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -2,6 +2,7 @@ import string
import pytest
import subprocess
import os
+import sys
import shutil
import signal
from collections import namedtuple
@@ -49,6 +50,7 @@ class ArtifactShare():
context = Context()
context.artifactdir = self.repodir
+ context.set_message_handler(self._message_handler)
self.cas = context.artifactcache
@@ -166,6 +168,13 @@ class ArtifactShare():
f_bavail=self.free_space - repo_size,
f_bsize=1)
+ def _message_handler(self, message, context):
+ # We need a message handler because this will own an ArtifactCache
+ # which can in turn fire messages.
+
+ # Just unconditionally print the messages to stderr
+ print(message.message, file=sys.stderr)
+
# create_artifact_share()
#