summaryrefslogtreecommitdiff
path: root/tests/artifactcache/push.py
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-03-28 12:31:50 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-05-15 10:18:26 +0000
commit30e89a6a3cdcea83e0d83e373e50b88c02df3667 (patch)
tree2ca584a89133bdc0efe2fa5d876173f48d7f396c /tests/artifactcache/push.py
parent7c1bb299c891b7fe8b92e1d54a38eca0b55840ef (diff)
downloadbuildstream-30e89a6a3cdcea83e0d83e373e50b88c02df3667.tar.gz
_artifact.py: Rework to use artifact proto
This will replace the previous use of a directory structure. Quite a lot is changed here, predominantly _artifact and _artifactcache modules. Part of #974
Diffstat (limited to 'tests/artifactcache/push.py')
-rw-r--r--tests/artifactcache/push.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/artifactcache/push.py b/tests/artifactcache/push.py
index a099ad136..4f31148b7 100644
--- a/tests/artifactcache/push.py
+++ b/tests/artifactcache/push.py
@@ -4,7 +4,7 @@ import signal
import pytest
-from buildstream import _yaml, _signals, utils
+from buildstream import _yaml, _signals, utils, Scope
from buildstream._context import Context
from buildstream._project import Project
from buildstream._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
@@ -85,7 +85,7 @@ def test_push(cli, tmpdir, datafiles):
# See https://github.com/grpc/grpc/blob/master/doc/fork_support.md for details
process = multiprocessing.Process(target=_queue_wrapper,
args=(_test_push, queue, user_config_file, project_dir,
- 'target.bst', element_key))
+ 'target.bst'))
try:
# Keep SIGINT blocked in the child process
@@ -102,7 +102,7 @@ def test_push(cli, tmpdir, datafiles):
assert share.has_artifact(cli.get_artifact_name(project_dir, 'test', 'target.bst', cache_key=element_key))
-def _test_push(user_config_file, project_dir, element_name, element_key, queue):
+def _test_push(user_config_file, project_dir, element_name, queue):
# Fake minimal context
context = Context()
context.load(config=user_config_file)
@@ -118,13 +118,22 @@ def _test_push(user_config_file, project_dir, element_name, element_key, queue):
# Load the target element
element = project.load_elements([element_name])[0]
+ # Ensure the element's artifact memeber is initialised
+ # This is duplicated from Pipeline.resolve_elements()
+ # as this test does not use the cli frontend.
+ for e in element.dependencies(Scope.ALL):
+ # Preflight
+ e._preflight()
+ # Determine initial element state.
+ e._update_state()
+
# Manually setup the CAS remotes
artifactcache.setup_remotes(use_config=True)
artifactcache.initialize_remotes()
if artifactcache.has_push_remotes(plugin=element):
# Push the element's artifact
- if not artifactcache.push(element, [element_key]):
+ if not element._push():
queue.put("Push operation failed")
else:
queue.put(None)