summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2019-01-04 15:40:22 +0000
committerJonathan Maw <jonathan.maw@codethink.co.uk>2019-01-07 13:27:15 +0000
commit6baec9f50074ef55e0255bf779bb6ba629d31463 (patch)
treec395e943f978abcf2bb340a72d771cfe145e72da
parent7dfb85b35a71c239f592e3aed50eddeddcd10406 (diff)
downloadbuildstream-6baec9f50074ef55e0255bf779bb6ba629d31463.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 00c0bd835..1ac45438a 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -1115,16 +1115,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):