summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-06-17 15:19:22 +0100
committerRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-06-21 11:09:07 +0100
commit1264347efc120730b5efd0a6126d99805880941d (patch)
tree914bd2451c3756e4458d30420b72de97f9224f5b
parent4f6113d26bcff1775c88bbfa0c1e3683a6efdda6 (diff)
downloadbuildstream-raoul/1044-blobs-on-demand.tar.gz
tests: Add case for using pull and use buildtreesraoul/1044-blobs-on-demand
Part of #1044
-rw-r--r--tests/integration/shellbuildtrees.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py
index b48f4afe7..a1eecb1eb 100644
--- a/tests/integration/shellbuildtrees.py
+++ b/tests/integration/shellbuildtrees.py
@@ -305,3 +305,32 @@ def test_buildtree_options(cli, tmpdir, datafiles):
assert 'Hi' in res.output
assert "buildtree is not cached locally, will attempt to pull from available remotes" in res.stderr
assert 'Attempting to fetch missing artifact buildtree' in res.stderr
+
+
+# Tests running pull and pull-buildtree options at the same time.
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox')
+def test_pull_buildtree_pulled(cli, tmpdir, datafiles):
+ project = str(datafiles)
+ element_name = 'build-shell/buildtree.bst'
+
+ with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share:
+ # Build the element to push it to cache
+ cli.configure({
+ 'artifacts': {'url': share.repo, 'push': True}
+ })
+ result = cli.run(project=project, args=['--cache-buildtrees', 'always', 'build', element_name])
+ result.assert_success()
+ assert cli.get_element_state(project, element_name) == 'cached'
+
+ # Discard the cache
+ shutil.rmtree(str(os.path.join(str(tmpdir), 'cache', 'cas')))
+ shutil.rmtree(str(os.path.join(str(tmpdir), 'cache', 'artifacts')))
+ assert cli.get_element_state(project, element_name) != 'cached'
+
+ # Check it's using the cached build tree
+ res = cli.run(project=project, args=[
+ '--pull-buildtrees', 'shell', '--build', element_name, '--pull',
+ '--use-buildtree', 'always', '--', 'cat', 'test'
+ ])
+ res.assert_success()