From a44c4b0e3cae671663c4d99b6d89d6a2f12add35 Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Sat, 22 Nov 2014 16:14:30 +0000 Subject: Add yarns to test deploying with relative paths --- yarns/deployment.yarn | 27 +++++++++++++++++++++++++++ yarns/implementations.yarn | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 58 insertions(+), 6 deletions(-) (limited to 'yarns') diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn index 0782c7c1..31406cc0 100644 --- a/yarns/deployment.yarn +++ b/yarns/deployment.yarn @@ -24,6 +24,33 @@ Morph Deployment Tests THEN morph succeeded FINALLY the git server is shut down + SCENARIO deploying a cluster using a relative path + GIVEN a workspace + AND a git server + WHEN the user checks out the system branch called master + AND the user builds the system systems/test-system.morph in branch master + AND from directory workspace/master/test/morphs/clusters the user attempts to deploy the cluster test-cluster.morph in branch master + THEN morph succeeded + FINALLY the git server is shut down + + SCENARIO deploying a cluster using a relative path (second variant) + GIVEN a workspace + AND a git server + WHEN the user checks out the system branch called master + AND the user builds the system systems/test-system.morph in branch master + AND from directory workspace/master/test/morphs/clusters the user attempts to deploy the cluster ../clusters/test-cluster.morph in branch master + THEN morph succeeded + FINALLY the git server is shut down + + SCENARIO deploying a cluster using an absolute path + GIVEN a workspace + AND a git server + WHEN the user checks out the system branch called master + AND the user builds the system systems/test-system.morph in branch master + AND from directory workspace/master/test/morphs/clusters the user attempts to deploy the cluster using the absolute path to test-cluster.morph in branch master + THEN morph succeeded + FINALLY the git server is shut down + Some deployment types support upgrades, but some do not and Morph needs to make this clear. diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index f73e3c64..83ff03c6 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -247,6 +247,19 @@ another to hold a chunk. morph: strata/core.morph EOF + mkdir "$DATADIR/gits/morphs/clusters" + cd "$DATADIR/gits/morphs" + install -m644 -D /dev/stdin << EOF "clusters/test-cluster.morph" + name: test-cluster + kind: cluster + systems: + - morph: systems/test-system.morph + deploy: + test-system: + type: tar + location: test.tar + EOF + install -m644 -D /dev/stdin << EOF "strata/build-essential.morph" name: build-essential kind: stratum @@ -723,14 +736,26 @@ 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 -- deploy "$MATCH_3" - if [ "$MATCH_5" != '' ]; then + IMPLEMENTS WHEN (from directory (\S+) )?the user (attempts to deploy|deploys) the (system|cluster) (using the absolute path to )?(\S+) in branch (\S+)( with options (.*))? + if [ "$MATCH_1" != "" ] + then + cd "$DATADIR/$MATCH_2" + else + cd "$DATADIR/workspace/$MATCH_7/test/morphs" + fi + + if [ "$MATCH_5" != "" ] + then + set -- deploy "$(pwd)/$MATCH_6" + else + set -- deploy "$MATCH_6" + fi + + if [ "$MATCH_8" != '' ]; then # eval used so word splitting in the text is preserved - eval set -- '"$@"' $MATCH_6 + eval set -- '"$@"' $MATCH_9 fi - if [ $MATCH_1 == "deploys" ]; then run_morph "$@" + if [ $MATCH_3 == "deploys" ]; then run_morph "$@" else attempt_morph "$@"; fi IMPLEMENTS WHEN the user (attempts to deploy|deploys) (.*) from cluster (\S+) in branch (\S+) -- cgit v1.2.1