summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Firth <dan.firth@codethink.co.uk>2013-10-31 14:28:12 +0000
committerDaniel Firth <dan.firth@codethink.co.uk>2013-11-01 15:27:10 +0000
commit6a1d074bfd30d5d24faf02725542ec87509c310a (patch)
tree5a4e9458fcfd5f57e749e807161d8f6c1a704119
parent2d16996377f369c97d35b7b48bdd336c2e8f5a08 (diff)
downloadmorph-6a1d074bfd30d5d24faf02725542ec87509c310a.tar.gz
Added scenario test to prevent morph edit from being used without a system argument
-rw-r--r--morphlib/plugins/branch_and_merge_new_plugin.py2
-rw-r--r--yarns/branches-workspaces.yarn10
-rw-r--r--yarns/implementations.yarn6
3 files changed, 17 insertions, 1 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py
index dba529d9..9c4cd53e 100644
--- a/morphlib/plugins/branch_and_merge_new_plugin.py
+++ b/morphlib/plugins/branch_and_merge_new_plugin.py
@@ -443,6 +443,8 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
logging.debug('Loading system morphology')
system_morph = loader.load_from_file(
sb.get_filename(sb.root_repository_url, system_name + '.morph'))
+ if system_morph['kind'] != 'system':
+ raise cliapp.AppException("%s is not a system" % system_name)
system_morph.repo_url = sb.root_repository_url
system_morph.ref = sb.system_branch_name
system_morph.filename = system_name + '.morph'
diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn
index b90c054c..fd2154e7 100644
--- a/yarns/branches-workspaces.yarn
+++ b/yarns/branches-workspaces.yarn
@@ -204,6 +204,16 @@ purposes.
AND in branch foo, stratum test-stratum refs test-chunk in foo
AND edited chunk test:test-chunk has git branch foo
+Morph edit should only work with a system argument.
+
+ SCENARIO morph edit errors when supplied only a stratum and chunk as arguments
+ GIVEN a workspace
+ AND a git server
+ WHEN checking out the master system branch
+ AND editing chunk test-chunk in stratum test-stratum with no system specified in branch master
+ THEN morph failed
+ AND the edit error message includes the string "is not a system"
+
Status of system branch checkout
--------------------------------
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index 85149f0a..1350662d 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -281,6 +281,10 @@ Editing morphologies with `morph edit`.
echo "$MATCH_2" > "$DATADIR/git-branch.wanted"
diff -u "$DATADIR/git-branch.wanted" "$DATADIR/git-branch.actual"
+ IMPLEMENTS WHEN editing chunk (\S+) in stratum (\S+) with no system specified in branch (\S+)
+ cd "$DATADIR/workspace/$MATCH_3"
+ attempt_morph edit "$MATCH_2" "$MATCH_1"
+
IMPLEMENTS WHEN creating an uncommitted system morphology called (\S+) for architecture (\S+) in system branch (\S+)
cat << EOF > "$DATADIR/workspace/$MATCH_3/test:morphs/$MATCH_1.morph"
arch: $MATCH_2
@@ -477,7 +481,7 @@ Implementation sections for deployment
Implementations sections for reading error messages
===================================================
- IMPLEMENTS THEN the (init|build|checkout|branch|deploy) error message includes the string "(.*)"
+ IMPLEMENTS THEN the (branch|build|checkout|deploy|edit|init) error message includes the string "(.*)"
grep "$MATCH_2" "$DATADIR/result-$MATCH_1"
IMPLEMENTS for test file and directory handling