[Notes] [Git][BuildStream/buildstream][bst-1.2] 2 commits: Improve error message for deleted open workspaces



Title: GitLab

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

Commits:

2 changed files:

Changes:

  • buildstream/_pipeline.py
    ... ... @@ -355,10 +355,14 @@ class Pipeline():
    355 355
         #
    
    356 356
         def assert_consistent(self, elements):
    
    357 357
             inconsistent = []
    
    358
    +        inconsistent_workspaced = []
    
    358 359
             with self._context.timed_activity("Checking sources"):
    
    359 360
                 for element in elements:
    
    360 361
                     if element._get_consistency() == Consistency.INCONSISTENT:
    
    361
    -                    inconsistent.append(element)
    
    362
    +                    if element._get_workspace():
    
    363
    +                        inconsistent_workspaced.append(element)
    
    364
    +                    else:
    
    365
    +                        inconsistent.append(element)
    
    362 366
     
    
    363 367
             if inconsistent:
    
    364 368
                 detail = "Exact versions are missing for the following elements:\n\n"
    
    ... ... @@ -372,6 +376,13 @@ class Pipeline():
    372 376
     
    
    373 377
                 raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline")
    
    374 378
     
    
    379
    +        if inconsistent_workspaced:
    
    380
    +            detail = "Some workspaces do not exist but are not closed\n" + \
    
    381
    +                     "Try closing them with `bst workspace close`\n\n"
    
    382
    +            for element in inconsistent_workspaced:
    
    383
    +                detail += "  " + element._get_full_name() + "\n"
    
    384
    +            raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline-workspaced")
    
    385
    +
    
    375 386
         #############################################################
    
    376 387
         #                     Private Methods                       #
    
    377 388
         #############################################################
    

  • tests/frontend/workspace.py
    ... ... @@ -699,3 +699,16 @@ def test_list_supported_workspace(cli, tmpdir, datafiles, workspace_cfg, expecte
    699 699
         # Check that workspace config is converted correctly if necessary
    
    700 700
         loaded_config = _yaml.node_sanitize(_yaml.load(workspace_config_path))
    
    701 701
         assert loaded_config == parse_dict_as_yaml(expected)
    
    702
    +
    
    703
    +
    
    704
    +@pytest.mark.datafiles(DATA_DIR)
    
    705
    +@pytest.mark.parametrize("kind", repo_kinds)
    
    706
    +def test_inconsitent_pipeline_message(cli, tmpdir, datafiles, kind):
    
    707
    +    element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, kind, False)
    
    708
    +
    
    709
    +    shutil.rmtree(workspace)
    
    710
    +
    
    711
    +    result = cli.run(project=project, args=[
    
    712
    +        'build', element_name
    
    713
    +    ])
    
    714
    +    result.assert_main_error(ErrorDomain.PIPELINE, "inconsistent-pipeline-workspaced")



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