summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-23 07:45:49 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-23 07:45:49 +0000
commite37ac3bcfa00b29cadc5509898fd6946b8e76132 (patch)
treeb463d3e1874efbeee1a5090db5d611615458342d
parentb0d1aa8340e1ffb0cecb119a80e368cfa2e724ef (diff)
parent2215859c925c48dfebd1315b4f5ad2834689ea22 (diff)
downloadbuildstream-e37ac3bcfa00b29cadc5509898fd6946b8e76132.tar.gz
Merge branch 'valentindavid/inconsistant-workspace' into 'master'
Improve error message for deleted open workspaces Closes #576 See merge request BuildStream/buildstream!703
-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 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")