summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQinusty <jrsmith9822@gmail.com>2018-08-29 16:25:48 +0000
committerQinusty <jrsmith9822@gmail.com>2018-08-29 16:25:48 +0000
commit9cc5817f95bc3632f86fa82175a0860a630aa33b (patch)
tree3425d0a119be6e2be58d0b110e892f2c1d4b8427
parent2df7607cd7790d73a2c99d13fa7ffe0dfdcf515f (diff)
parent19e87afb1aa89fe68811c8b2970bc59e9f7d85e4 (diff)
downloadbuildstream-9cc5817f95bc3632f86fa82175a0860a630aa33b.tar.gz
Merge branch 'bschubert/log-missed-cache' into 'master'
Log not-found objects in the cache as SKIPPED See merge request BuildStream/buildstream!729
-rw-r--r--buildstream/_artifactcache/cascache.py7
-rw-r--r--tests/frontend/pull.py19
2 files changed, 26 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index c6402717c..9a9f7024f 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -249,6 +249,13 @@ class CASCache(ArtifactCache):
if e.code() != grpc.StatusCode.NOT_FOUND:
raise ArtifactError("Failed to pull artifact {}: {}".format(
element._get_brief_display_key(), e)) from e
+ else:
+ self.context.message(Message(
+ None,
+ MessageType.SKIPPED,
+ "Remote ({}) does not have {} cached".format(
+ remote.spec.url, element._get_brief_display_key())
+ ))
return False
diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py
index 9d2d5d1a2..ed9a9643e 100644
--- a/tests/frontend/pull.py
+++ b/tests/frontend/pull.py
@@ -338,3 +338,22 @@ def test_pull_missing_blob(cli, tmpdir, datafiles):
# Assert that no artifacts were pulled
assert len(result.get_pulled_elements()) == 0
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_pull_missing_notifies_user(caplog, cli, tmpdir, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ caplog.set_level(1)
+
+ with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share:
+
+ cli.configure({
+ 'artifacts': {'url': share.repo}
+ })
+ result = cli.run(project=project, args=['build', 'target.bst'])
+
+ result.assert_success()
+ assert not result.get_pulled_elements(), \
+ "No elements should have been pulled since the cache was empty"
+
+ assert "SKIPPED Remote ({}) does not have".format(share.repo) in result.stderr