summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2019-01-04 15:40:22 +0000
committerJürg Billeter <j@bitron.ch>2019-01-24 11:15:06 +0100
commit5b0bba8565820e3aec02945051698ce258e149c4 (patch)
treedd98032faa921782b1fd468750fb7276706f65b4
parent40c18174722ea54d54e5f2e9c458f7fbaa4c5e2d (diff)
downloadbuildstream-5b0bba8565820e3aec02945051698ce258e149c4.tar.gz
Test that tracking in workspaces actually works
Previously, it merely tested that buildstream did not fall other, rather than whether it did anything useful.
-rw-r--r--tests/frontend/workspace.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index d73bb1c70..f43061305 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -1120,16 +1120,24 @@ def test_external_push_pull(cli, datafiles, tmpdir_factory, guess_element):
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("guess_element", [True, False], ids=["guess", "no-guess"])
def test_external_track(cli, datafiles, tmpdir_factory, guess_element):
- # Tracking does not get horribly confused
tmpdir = tmpdir_factory.mktemp('')
- element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, "git", True)
+ element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, "git", False)
+ element_file = os.path.join(str(datafiles), 'elements', element_name)
arg_elm = [element_name] if not guess_element else []
- # The workspace is necessarily already tracked, so we only care that
- # there's no weird errors.
+ # Delete the ref from the source so that we can detect if the
+ # element has been tracked
+ element_contents = _yaml.load(element_file)
+ del element_contents['sources'][0]['ref']
+ _yaml.dump(_yaml.node_sanitize(element_contents), element_file)
+
result = cli.run(project=project, args=['-C', workspace, 'source', 'track'] + arg_elm)
result.assert_success()
+ # Element is tracked now
+ element_contents = _yaml.load(element_file)
+ assert 'ref' in element_contents['sources'][0]
+
@pytest.mark.datafiles(DATA_DIR)
def test_external_open_other(cli, datafiles, tmpdir_factory):