summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2020-07-06 09:13:10 +0100
committerDarius Makovsky <traveltissues@protonmail.com>2020-07-06 09:20:31 +0100
commitd2eaec482925587431d926a14a8b3142e9eac018 (patch)
treea1bb4c8f905fe2dad190b315fbf0607543e6f9e6
parent6469757d851df8cdc9c54ab6e87e8d0edd91579f (diff)
downloadbuildstream-traveltissues/fix-Nonetype-guard.tar.gz
-rw-r--r--tests/artifactcache/junctions.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/artifactcache/junctions.py b/tests/artifactcache/junctions.py
index df7ee9473..aa9ea04a0 100644
--- a/tests/artifactcache/junctions.py
+++ b/tests/artifactcache/junctions.py
@@ -132,6 +132,44 @@ def test_caching_junction_elements(cli, tmpdir, datafiles):
@pytest.mark.datafiles(DATA_DIR)
+def test_caching_junction_elements_no_parent_cache(cli, tmpdir, datafiles):
+ project = os.path.join(str(datafiles), "parent")
+ base_project = os.path.join(str(project), "base")
+
+ # Load the junction element
+ junction_element = os.path.join(project, "base.bst")
+ junction_data = _yaml.roundtrip_load(junction_element)
+
+ # Configure to push everything to the junction's remote
+ junction_data["config"] = {"cache-junction-elements": True}
+ _yaml.roundtrip_dump(junction_data, junction_element)
+
+ with create_artifact_share(os.path.join(str(tmpdir), "artifactshare-base")) as base_share:
+
+ # First build it without the artifact cache configured
+ result = cli.run(project=project, args=["build", "target.bst"])
+ assert result.exit_code == 0
+
+ # Assert that we are now cached locally
+ state = cli.get_element_state(project, "target.bst")
+ assert state == "cached"
+ state = cli.get_element_state(base_project, "base-element.bst")
+ assert state == "cached"
+
+ project_set_artifacts(base_project, base_share.repo)
+
+ # Push to the remote(s))
+ result = cli.run(project=project, args=["artifact", "push", "--deps", "all", "target.bst"])
+ assert result.exit_code == 0
+
+ # And finally assert that the artifacts are in the right shares
+ # The junction project's cache should contain only junction elements
+ assert_not_shared(cli, base_share, project, "target.bst", project_name="parent")
+ assert_not_shared(cli, base_share, project, "app.bst", project_name="parent")
+ assert_shared(cli, base_share, base_project, "base-element.bst", project_name="base")
+
+
+@pytest.mark.datafiles(DATA_DIR)
def test_ignore_junction_remotes(cli, tmpdir, datafiles):
project = os.path.join(str(datafiles), "parent")
base_project = os.path.join(str(project), "base")