You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/08/15 08:00:20 UTC

[buildstream] 03/03: tests/integration/shellbuildtrees.py: Add test for shelling into an artifact

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/shell-artifacts
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 4282619570b30e16e916aaf7fde9b176f41ab3c9
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Aug 15 16:58:25 2022 +0900

    tests/integration/shellbuildtrees.py: Add test for shelling into an artifact
---
 tests/integration/shellbuildtrees.py | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py
index b27a25a88..0dfeb6587 100644
--- a/tests/integration/shellbuildtrees.py
+++ b/tests/integration/shellbuildtrees.py
@@ -326,6 +326,40 @@ def test_shell_pull_cached_buildtree(share_with_buildtrees, datafiles, cli, pull
     assert "Hi" in result.output
 
 
+#
+# Test behavior of shelling into a buildtree by its artifact name
+#
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
+def test_shell_pull_artifact_cached_buildtree(share_with_buildtrees, datafiles, cli):
+    project = str(datafiles)
+    artifact_name = "test/build-shell-buildtree/4a47c98a10df39e65e99d471f96edc5b58d4ea5b9b1f221d0be832a8124b8099"
+
+    cli.configure({"artifacts": {"servers": [{"url": share_with_buildtrees.repo}]}})
+
+    # Run the shell and request that required artifacts and buildtrees should be pulled
+    result = cli.run(
+        project=project,
+        args=[
+            "--pull-buildtrees",
+            "shell",
+            "--build",
+            "--use-buildtree",
+            artifact_name,
+            "--",
+            "cat",
+            # We don't preserve the working directory in artifacts, so we will executing be at /
+            "/buildstream/test/build-shell/buildtree.bst/test",
+        ],
+    )
+
+    # In this case, we should succeed every time, regardless of what was
+    # originally available in the local cache.
+    #
+    result.assert_success()
+    assert "Hi" in result.output
+
+
 #
 # Test behavior of launching a shell and requesting to use a buildtree.
 #