summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-07-12 05:37:24 +0200
committerJürg Billeter <j@bitron.ch>2019-08-20 08:09:52 +0200
commitd5105710da5fa20272bc4fb21f5573e94e8d997b (patch)
treef6c0af326b07d5e542a0a0bad1af7f57170c2c69
parent917e43d0d370bae80276450004df523339e92bc1 (diff)
downloadbuildstream-d5105710da5fa20272bc4fb21f5573e94e8d997b.tar.gz
tests/testutils/artifactshare.py: Allow write access via casd
-rw-r--r--tests/testutils/artifactshare.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index 231559a56..132b6ac4f 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -22,6 +22,7 @@ from buildstream._protos.buildstream.v2 import artifact_pb2
# directory (str): The base temp directory for the test
# total_space (int): Mock total disk space on artifact server
# free_space (int): Mock free disk space on artifact server
+# casd (bool): Allow write access via casd
#
class ArtifactShare():
@@ -29,7 +30,8 @@ class ArtifactShare():
total_space=None,
free_space=None,
min_head_size=int(2e9),
- max_head_size=int(10e9)):
+ max_head_size=int(10e9),
+ casd=False):
# The working directory for the artifact share (in case it
# needs to do something outside of its backend's storage folder).
@@ -46,7 +48,7 @@ class ArtifactShare():
self.artifactdir = os.path.join(self.repodir, 'artifacts', 'refs')
os.makedirs(self.artifactdir)
- self.cas = CASCache(self.repodir, casd=False)
+ self.cas = CASCache(self.repodir, casd=casd)
self.total_space = total_space
self.free_space = free_space
@@ -199,9 +201,11 @@ class ArtifactShare():
@contextmanager
def create_artifact_share(directory, *, total_space=None, free_space=None,
min_head_size=int(2e9),
- max_head_size=int(10e9)):
+ max_head_size=int(10e9),
+ casd=False):
share = ArtifactShare(directory, total_space=total_space, free_space=free_space,
- min_head_size=min_head_size, max_head_size=max_head_size)
+ min_head_size=min_head_size, max_head_size=max_head_size,
+ casd=casd)
try:
yield share
finally: