summaryrefslogtreecommitdiff
path: root/tests/artifactcache
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-07-01 11:28:44 +0100
committerJürg Billeter <j@bitron.ch>2019-08-20 07:41:23 +0200
commit704266c2091eb3302fc979a892142a852564a55c (patch)
tree32eb6d1ec6c91f54d993f0b6c37987fdad849425 /tests/artifactcache
parente92781bdb7e76b91195fef84039fe7ff51cd02bf (diff)
downloadbuildstream-704266c2091eb3302fc979a892142a852564a55c.tar.gz
tests/artifactcache/artifactservice.py: Add objects in subprocess
This is in preparation for buildbox-casd, which will disallow local CAS cache writes from the main process (gRPC).
Diffstat (limited to 'tests/artifactcache')
-rw-r--r--tests/artifactcache/artifactservice.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/artifactcache/artifactservice.py b/tests/artifactcache/artifactservice.py
index ac9514793..1456185a4 100644
--- a/tests/artifactcache/artifactservice.py
+++ b/tests/artifactcache/artifactservice.py
@@ -87,18 +87,8 @@ def _artifact_request(url, queue):
def test_update_artifact(tmpdir, files):
sharedir = os.path.join(str(tmpdir), "share")
with create_artifact_share(sharedir) as share:
- # put files object
- if files == "present":
- directory = re_pb2.Directory()
- digest = share.cas.add_object(buffer=directory.SerializeToString())
- elif files == "invalid":
- digest = share.cas.add_object(buffer="abcdefghijklmnop".encode("utf-8"))
- elif files == "absent":
- digest = utils._message_digest("abcdefghijklmnop".encode("utf-8"))
-
- url = urlparse(share.repo)
queue = Queue()
- process = Process(target=_queue_wrapper, args=(_get_artifact, queue, url, files, digest))
+ process = Process(target=_queue_wrapper, args=(_update_artifact, queue, share, files))
try:
with _signals.blocked([signal.SIGINT], ignore=False):
@@ -112,7 +102,18 @@ def test_update_artifact(tmpdir, files):
assert not error
-def _get_artifact(url, files, digest, queue):
+def _update_artifact(share, files, *, queue):
+ # put files object
+ if files == "present":
+ directory = re_pb2.Directory()
+ digest = share.cas.add_object(buffer=directory.SerializeToString())
+ elif files == "invalid":
+ digest = share.cas.add_object(buffer="abcdefghijklmnop".encode("utf-8"))
+ elif files == "absent":
+ digest = utils._message_digest("abcdefghijklmnop".encode("utf-8"))
+
+ url = urlparse(share.repo)
+
channel = grpc.insecure_channel("{}:{}".format(url.hostname, url.port))
artifact_stub = ArtifactServiceStub(channel)