diff options
author | Valentin David <valentin.david@codethink.co.uk> | 2018-08-22 20:31:43 +0200 |
---|---|---|
committer | Valentin David <valentin.david@codethink.co.uk> | 2018-08-22 20:31:43 +0200 |
commit | 1479b32c75e8d1153be148ce3b06b26e743f8da8 (patch) | |
tree | 96e743b4faf7bf75305de9c0224a053a7b856d74 | |
parent | 5b79bbb725bfa52689bcd8bfeddd15ce4d1ecd5d (diff) | |
download | buildstream-valentindavid/inconsistant-workspace.tar.gz |
Improve error message for deleted open workspacesvalentindavid/inconsistant-workspace
Fixes #576.
-rw-r--r-- | buildstream/_pipeline.py | 13 | ||||
-rw-r--r-- | tests/frontend/workspace.py | 13 |
2 files changed, 25 insertions, 1 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 4e5f4d0e9..1f75b2e9e 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -355,10 +355,14 @@ class Pipeline(): # def assert_consistent(self, elements): inconsistent = [] + inconsistent_workspaced = [] with self._context.timed_activity("Checking sources"): for element in elements: if element._get_consistency() == Consistency.INCONSISTENT: - inconsistent.append(element) + if element._get_workspace(): + inconsistent_workspaced.append(element) + else: + inconsistent.append(element) if inconsistent: detail = "Exact versions are missing for the following elements:\n\n" @@ -372,6 +376,13 @@ class Pipeline(): raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline") + if inconsistent_workspaced: + detail = "Some workspaces do not exist but are not closed\n" + \ + "Try closing them with `bst workspace close`\n\n" + for element in inconsistent_workspaced: + detail += " " + element._get_full_name() + "\n" + raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline-workspaced") + ############################################################# # Private Methods # ############################################################# diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py index c7af0a70f..bd4bacd74 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -767,3 +767,16 @@ def test_list_supported_workspace(cli, tmpdir, datafiles, workspace_cfg, expecte # Check that workspace config is converted correctly if necessary loaded_config = _yaml.node_sanitize(_yaml.load(workspace_config_path)) assert loaded_config == parse_dict_as_yaml(expected) + + +@pytest.mark.datafiles(DATA_DIR) +@pytest.mark.parametrize("kind", repo_kinds) +def test_inconsitent_pipeline_message(cli, tmpdir, datafiles, kind): + element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, kind, False) + + shutil.rmtree(workspace) + + result = cli.run(project=project, args=[ + 'build', element_name + ]) + result.assert_main_error(ErrorDomain.PIPELINE, "inconsistent-pipeline-workspaced") |