summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2019-07-19 18:29:08 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-19 18:29:08 +0000
commitff39b3524f3c544b1a08cb8e26da160e143e5266 (patch)
tree0cfa2421c8543255f5adb2b2316e0b6efda9b88b /tests
parent4de721d62bec7ab07f55e425c2d2388e0923cd56 (diff)
parent4db64fcdd73c4bc09be2d68132858989280c69d3 (diff)
downloadbuildstream-ff39b3524f3c544b1a08cb8e26da160e143e5266.tar.gz
Merge branch 'chandan/workspace-force-no-checkout' into 'master'traveltissues/benchmark-1088
Don't remove workspace directory when `--no-checkout` option is given Closes #1086 See merge request BuildStream/buildstream!1490
Diffstat (limited to 'tests')
-rw-r--r--tests/frontend/project/elements/test.bst0
-rw-r--r--tests/frontend/workspace.py25
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/frontend/project/elements/test.bst b/tests/frontend/project/elements/test.bst
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/project/elements/test.bst
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 6e23ec488..ad0fc7371 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -355,6 +355,31 @@ def test_open_force_open(cli, tmpdir, datafiles):
result.assert_success()
+# Regression test for #1086.
+@pytest.mark.datafiles(DATA_DIR)
+def test_open_force_open_no_checkout(cli, tmpdir, datafiles):
+ element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, 'git', False)
+ hello_path = os.path.join(workspace, 'hello.txt')
+
+ # Assert the workspace dir exists
+ assert os.path.exists(workspace)
+
+ # Create a new file in the workspace
+ with open(hello_path, 'w') as f:
+ f.write('hello')
+
+ # Now open the workspace again with --force and --no-checkout
+ result = cli.run(project=project, args=[
+ 'workspace', 'open', '--force', '--no-checkout', '--directory', workspace, element_name
+ ])
+ result.assert_success()
+
+ # Ensure that our files were not overwritten
+ assert os.path.exists(hello_path)
+ with open(hello_path) as f:
+ assert f.read() == 'hello'
+
+
@pytest.mark.datafiles(DATA_DIR)
def test_open_force_different_workspace(cli, tmpdir, datafiles):
_, project, workspace = open_workspace(cli, tmpdir, datafiles, 'git', False, "-alpha")