[Notes] [Git][BuildStream/buildstream][bst-1.2] 3 commits: Log not-found objects in the cache as SKIPPED



Title: GitLab

Tristan Van Berkom pushed to branch bst-1.2 at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • buildstream/_artifactcache/cascache.py
    ... ... @@ -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
     
    

  • tests/frontend/pull.py
    ... ... @@ -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



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]