You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2021/03/24 10:25:21 UTC

[buildstream] 02/02: tests/frontend/buildcheckout.py: Add test_non_strict_checkout_uncached

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

juergbi pushed a commit to branch juerg/pull-non-strict
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit f8b9d2e5f1c4438d6bfba4302e6bc1f520474267
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Wed Mar 24 11:23:15 2021 +0100

    tests/frontend/buildcheckout.py: Add test_non_strict_checkout_uncached
    
    This is a regression test for #1469.
---
 tests/frontend/buildcheckout.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py
index 628e886..72587b3 100644
--- a/tests/frontend/buildcheckout.py
+++ b/tests/frontend/buildcheckout.py
@@ -148,6 +148,27 @@ def test_non_strict_pull_build_strict_checkout(datafiles, cli, tmpdir):
         assert os.path.exists(filename)
 
 
+# Regression test for https://github.com/apache/buildstream/issues/1469
+# Test that artifact checkout without pull doesn't trigger a BUG in non-strict mode.
+@pytest.mark.datafiles(DATA_DIR)
+def test_non_strict_checkout_uncached(datafiles, cli, tmpdir):
+    project = str(datafiles)
+    checkout = os.path.join(cli.directory, "checkout")
+
+    element_name = "target.bst"
+
+    with create_artifact_share(os.path.join(str(tmpdir), "artifactshare")) as share:
+
+        cli.configure({"artifacts": {"servers": [{"url": share.repo}]}})
+
+        # Attempt to checkout an uncached artifact with remote artifact server
+        # configured but pull disabled.
+        result = cli.run(
+            project=project, args=["--no-strict", "artifact", "checkout", element_name, "--directory", checkout]
+        )
+        result.assert_main_error(ErrorDomain.STREAM, "uncached-checkout-attempt")
+
+
 @pytest.mark.datafiles(DATA_DIR)
 @pytest.mark.parametrize("strict,hardlinks", [("non-strict", "hardlinks"),])
 def test_build_invalid_suffix(datafiles, cli, strict, hardlinks):