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



Title: GitLab

Tristan Van Berkom pushed to branch master 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
    ... ... @@ -767,3 +767,16 @@ def test_list_supported_workspace(cli, tmpdir, datafiles, workspace_cfg, expecte
    767 767
         # Check that workspace config is converted correctly if necessary
    
    768 768
         loaded_config = _yaml.node_sanitize(_yaml.load(workspace_config_path))
    
    769 769
         assert loaded_config == parse_dict_as_yaml(expected)
    
    770
    +
    
    771
    +
    
    772
    +@pytest.mark.datafiles(DATA_DIR)
    
    773
    +@pytest.mark.parametrize("kind", repo_kinds)
    
    774
    +def test_inconsitent_pipeline_message(cli, tmpdir, datafiles, kind):
    
    775
    +    element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, kind, False)
    
    776
    +
    
    777
    +    shutil.rmtree(workspace)
    
    778
    +
    
    779
    +    result = cli.run(project=project, args=[
    
    780
    +        'build', element_name
    
    781
    +    ])
    
    782
    +    result.assert_main_error(ErrorDomain.PIPELINE, "inconsistent-pipeline-workspaced")



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