summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-03-28 15:34:32 +0100
committerJürg Billeter <j@bitron.ch>2019-04-12 11:17:33 +0200
commitad3a73d4c80e10e44869e20fdcd389e07d59edab (patch)
tree06fe65234dc51bfb93d8fb82dafddd9bd8eb500d
parent96cca33a756b5855153e84f719029e80f2fa69c2 (diff)
downloadbuildstream-ad3a73d4c80e10e44869e20fdcd389e07d59edab.tar.gz
tests/remoteexecution/partial.py: Add test for partial CAS
-rw-r--r--tests/remoteexecution/partial.py43
-rw-r--r--tests/remoteexecution/project/elements/no-runtime-deps.bst9
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/remoteexecution/partial.py b/tests/remoteexecution/partial.py
new file mode 100644
index 000000000..907fc507d
--- /dev/null
+++ b/tests/remoteexecution/partial.py
@@ -0,0 +1,43 @@
+import os
+import pytest
+
+from buildstream._exceptions import ErrorDomain
+from buildstream.plugintestutils import cli_remote_execution as cli
+from buildstream.plugintestutils.integration import assert_contains
+
+
+pytestmark = pytest.mark.remoteexecution
+
+
+DATA_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ "project"
+)
+
+
+# Test that `bst build` does not download file blobs of a build-only dependency
+# to the local cache.
+@pytest.mark.datafiles(DATA_DIR)
+def test_build_dependency_partial_local_cas(cli, datafiles):
+ project = str(datafiles)
+ element_name = 'no-runtime-deps.bst'
+ builddep_element_name = 'autotools/amhello.bst'
+ checkout = os.path.join(cli.directory, 'checkout')
+ builddep_checkout = os.path.join(cli.directory, 'builddep-checkout')
+
+ services = cli.ensure_services()
+ assert set(services) == set(['action-cache', 'execution', 'storage'])
+
+ result = cli.run(project=project, args=['build', element_name])
+ result.assert_success()
+
+ # Verify that the target element is available in local cache
+ result = cli.run(project=project, args=['artifact', 'checkout', element_name,
+ '--directory', checkout])
+ result.assert_success()
+ assert_contains(checkout, ['/test'])
+
+ # Verify that the build-only dependency is not (complete) in the local cache
+ result = cli.run(project=project, args=['artifact', 'checkout', builddep_element_name,
+ '--directory', builddep_checkout])
+ result.assert_main_error(ErrorDomain.STREAM, 'uncached-checkout-attempt')
diff --git a/tests/remoteexecution/project/elements/no-runtime-deps.bst b/tests/remoteexecution/project/elements/no-runtime-deps.bst
new file mode 100644
index 000000000..ca76aaf9f
--- /dev/null
+++ b/tests/remoteexecution/project/elements/no-runtime-deps.bst
@@ -0,0 +1,9 @@
+kind: manual
+description: Test element without runtime dependencies
+
+build-depends:
+- autotools/amhello.bst
+
+config:
+ install-commands:
+ - echo Test > %{install-root}/test