summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin David <valentin.david@codethink.co.uk>2018-08-22 20:31:43 +0200
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-08-23 16:06:20 +0900
commit2a33f557b6c3c940bdef3b539d7117c439ecc1ac (patch)
tree4ee7eadf5f1b368d0daa9e7ee6bee5d5fc97a97e
parent1a344adc8a71410348a2e9b893ec8cbd07da5f62 (diff)
downloadbuildstream-tristan/inconsistent-workspace-1.2.tar.gz
Improve error message for deleted open workspacestristan/inconsistent-workspace-1.2
Fixes #576.
-rw-r--r--buildstream/_pipeline.py13
-rw-r--r--tests/frontend/workspace.py13
2 files changed, 25 insertions, 1 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 3b9fb0de9..17264ae23 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 566fbb1cd..97fcd93d4 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -699,3 +699,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")