Benjamin Schubert pushed to branch bschubert/log-missed-cache at BuildStream / buildstream
Commits:
-
c146dde5
by Benjamin Schubert at 2018-08-29T16:00:24Z
-
19e87afb
by Benjamin Schubert at 2018-08-29T16:01:12Z
2 changed files:
Changes:
... | ... | @@ -249,6 +249,13 @@ class CASCache(ArtifactCache): |
249 | 249 |
if e.code() != grpc.StatusCode.NOT_FOUND:
|
250 | 250 |
raise ArtifactError("Failed to pull artifact {}: {}".format(
|
251 | 251 |
element._get_brief_display_key(), e)) from e
|
252 |
+ else:
|
|
253 |
+ self.context.message(Message(
|
|
254 |
+ None,
|
|
255 |
+ MessageType.SKIPPED,
|
|
256 |
+ "Remote ({}) does not have {} cached".format(
|
|
257 |
+ remote.spec.url, element._get_brief_display_key())
|
|
258 |
+ ))
|
|
252 | 259 |
|
253 | 260 |
return False
|
254 | 261 |
|
... | ... | @@ -338,3 +338,22 @@ def test_pull_missing_blob(cli, tmpdir, datafiles): |
338 | 338 |
|
339 | 339 |
# Assert that no artifacts were pulled
|
340 | 340 |
assert len(result.get_pulled_elements()) == 0
|
341 |
+ |
|
342 |
+ |
|
343 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
344 |
+def test_pull_missing_notifies_user(caplog, cli, tmpdir, datafiles):
|
|
345 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
346 |
+ caplog.set_level(1)
|
|
347 |
+ |
|
348 |
+ with create_artifact_share(os.path.join(str(tmpdir), 'artifactshare')) as share:
|
|
349 |
+ |
|
350 |
+ cli.configure({
|
|
351 |
+ 'artifacts': {'url': share.repo}
|
|
352 |
+ })
|
|
353 |
+ result = cli.run(project=project, args=['build', 'target.bst'])
|
|
354 |
+ |
|
355 |
+ result.assert_success()
|
|
356 |
+ assert not result.get_pulled_elements(), \
|
|
357 |
+ "No elements should have been pulled since the cache was empty"
|
|
358 |
+ |
|
359 |
+ assert "SKIPPED Remote ({}) does not have".format(share.repo) in result.stderr
|