summaryrefslogtreecommitdiff
path: root/tests/integration/shellbuildtrees.py
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-24 11:43:01 +0100
commit3255fe9d6b5facc0096e2585a157719898272e75 (patch)
tree5aac4491cec29a17a7a083340b86ea4bb6e843b3 /tests/integration/shellbuildtrees.py
parent2ab50f239d09cbe41f9a13bc581d8b69e974c0bd (diff)
downloadbuildstream-3255fe9d6b5facc0096e2585a157719898272e75.tar.gz
tests: Add case for using pull and use buildtrees
Part of #1044
Diffstat (limited to 'tests/integration/shellbuildtrees.py')
-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()