diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-12-19 15:23:51 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2014-01-10 11:37:52 +0000 |
commit | 6ff6be3c0844669f9ad7f1a812be7532f6d154c5 (patch) | |
tree | 8e671ded0077ebfa7b46bbfd5db29f30fda686ba | |
parent | df10110a046d79aa20c5685372a59fd554e66d7f (diff) | |
download | morph-6ff6be3c0844669f9ad7f1a812be7532f6d154c5.tar.gz |
yarns: Add a deploy test
-rw-r--r-- | yarns/deployment.yarn | 9 | ||||
-rw-r--r-- | yarns/implementations.yarn | 43 |
2 files changed, 49 insertions, 3 deletions
diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn index 35f933b7..855ecc52 100644 --- a/yarns/deployment.yarn +++ b/yarns/deployment.yarn @@ -8,3 +8,12 @@ Morph Deployment Tests AND the user attempts to deploy the system test-system in branch master THEN morph failed AND the deploy error message includes the string "morph deploy is only supported for cluster morphologies" + + SCENARIO deploying a cluster morphology + GIVEN a workspace + AND a git server + WHEN the user checks out the system branch called master + GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master + WHEN the user builds the system test-system in branch master + AND the user attempts to deploy the cluster test-cluster in branch master with options system.location=test.tar + THEN morph succeeded diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index 374180fe..4265aa0b 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -30,6 +30,14 @@ we can test it later in a THEN step. 0) die "Morph should have failed, but didn't. Unexpected success!" ;; esac + IMPLEMENTS THEN morph succeeded + case $(cat "$DATADIR/morph-exit") in + 0) echo "Morph succeeded!" + ;; + *) die "Morph should have succeeded, but didn't. Unexpected failure!" + ;; + esac + We need to check that a workspace creation worked. This requires the directory to exist, and its `.morph` subdirectory to exist, and nothing else. @@ -603,11 +611,40 @@ Implementation sections for cross-bootstraping Implementation sections for deployment ====================================== - IMPLEMENTS WHEN the user (attempts to deploy|deploys) the (system|cluster) (\S+) in branch (\S+) +Defaults are set in the cluster morphology, so we can deploy without +setting any extra parameters, but we also need to be able to override +them, so they can be added to the end of the implements section. + + IMPLEMENTS WHEN the user (attempts to deploy|deploys) the (system|cluster) (\S+) in branch (\S+)( with options (.*))? cd "$DATADIR/workspace/$MATCH_4" - set build "$MATCH_3" + set -- deploy "$MATCH_3" + if [ "$MATCH_5" != '' ]; then + # eval used so word splitting in the text is preserved + eval set -- '"$@"' $MATCH_6 + fi if [ $MATCH_1 == "deploys" ]; then run_morph "$@" - else attempt_morph deploy "$MATCH_3"; fi + else attempt_morph "$@"; fi + +To successfully deploy systems, we need a cluster morphology. Since the +common case is to just have one system, we generate a stub morphology +with only the minimal information. + + IMPLEMENTS GIVEN a cluster called (\S+) for deploying only the (\S+) system as type (\S+) in system branch (\S+) + name="$MATCH_1" + system="$MATCH_2" + type="$MATCH_3" + branch="$MATCH_4" + cat << EOF > "$DATADIR/workspace/$branch/test:morphs/$name.morph" + name: $name + kind: cluster + systems: + - morph: $system + repo: test:morphs + ref: $branch + deploy: + system: + type: $type + EOF Implementations sections for reading error messages =================================================== |