summaryrefslogtreecommitdiff
path: root/tests/artifactcache/pull.py
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2019-03-21 12:59:56 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-03-29 10:38:53 +0000
commitd93763daa96c159fbf891219b71a7e5e9a31a971 (patch)
tree8298ed673c395104bbf311cb12b5801be6a5583d /tests/artifactcache/pull.py
parent35616512815cc3edc22b7aab128744a81b21c32f (diff)
downloadbuildstream-d93763daa96c159fbf891219b71a7e5e9a31a971.tar.gz
plugintestutils/runcli.py: Add TestArtifact() 'abstraction' class
This adds the initial Artifact 'abstractions', taking existing test methods into a dedicated Artifact class. The class is accessed via an instance attribute of the generic Cli() fixture. This is in preperation for AaaP, to ensure existing tests pass whilst creating an entry point for further abstractions when necessary.
Diffstat (limited to 'tests/artifactcache/pull.py')
-rw-r--r--tests/artifactcache/pull.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/artifactcache/pull.py b/tests/artifactcache/pull.py
index 3c10c256c..d75b6d3c7 100644
--- a/tests/artifactcache/pull.py
+++ b/tests/artifactcache/pull.py
@@ -95,15 +95,14 @@ def test_pull(cli, tmpdir, datafiles):
context.load(config=user_config_file)
context.set_message_handler(message_handler)
- # Load the project and CAS cache
+ # Load the project
project = Project(project_dir, context)
project.ensure_fully_loaded()
- cas = context.artifactcache
# Assert that the element's artifact is **not** cached
element = project.load_elements(['target.bst'])[0]
element_key = cli.get_element_key(project_dir, 'target.bst')
- assert not cas.contains(element, element_key)
+ assert not cli.artifact.is_cached(cache_dir, element, element_key)
queue = multiprocessing.Queue()
# Use subprocess to avoid creation of gRPC threads in main BuildStream process
@@ -124,7 +123,7 @@ def test_pull(cli, tmpdir, datafiles):
raise
assert not error
- assert cas.contains(element, element_key)
+ assert cli.artifact.is_cached(cache_dir, element, element_key)
def _test_pull(user_config_file, project_dir, cache_dir,
@@ -209,11 +208,10 @@ def test_pull_tree(cli, tmpdir, datafiles):
# Assert that the element's artifact is cached
element = project.load_elements(['target.bst'])[0]
element_key = cli.get_element_key(project_dir, 'target.bst')
- assert artifactcache.contains(element, element_key)
+ assert cli.artifact.is_cached(rootcache_dir, element, element_key)
# Retrieve the Directory object from the cached artifact
- artifact_ref = element.get_artifact_name(element_key)
- artifact_digest = cas.resolve_ref(artifact_ref)
+ artifact_digest = cli.artifact.get_digest(rootcache_dir, element, element_key)
queue = multiprocessing.Queue()
# Use subprocess to avoid creation of gRPC threads in main BuildStream process