From 6a1d074bfd30d5d24faf02725542ec87509c310a Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Thu, 31 Oct 2013 14:28:12 +0000 Subject: Added scenario test to prevent morph edit from being used without a system argument --- morphlib/plugins/branch_and_merge_new_plugin.py | 2 ++ yarns/branches-workspaces.yarn | 10 ++++++++++ yarns/implementations.yarn | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1