diff options
authorAdam Coldrick <>2014-07-03 13:50:02 (GMT)
committerAdam Coldrick <>2014-07-03 13:50:02 (GMT)
commit776d77012234fd14882116d6a767b82a21f9b089 (patch)
parenta82d6573794c45e3065100561698a86f9e3e610c (diff)
Add a yarn test to test building and deploying a system with a chunk in definitionsbaserock/adamcoldrick/load-chunks-from-definitions-wip
3 files changed, 67 insertions, 0 deletions
diff --git a/scripts/edit-morph b/scripts/edit-morph
index d0b793a..9f576f7 100755
--- a/scripts/edit-morph
+++ b/scripts/edit-morph
@@ -249,6 +249,12 @@ class EditMorph(cliapp.Application):
with self._open_yaml(file_path) as d:
d['products'] = yaml.load(match_rules)
+ def cmd_edit_chunk_spec(self, (spec_name, stratum_file, key, value)):
+ with self._open_yaml(stratum_file) as stratum:
+ for spec in stratum['chunks']:
+ if spec['name'] == spec_name:
+ spec[key] = value
def _splice_cluster_system(cls, syslist, syspath):
sysname = syspath[0]
@@ -327,4 +333,10 @@ class EditMorph(cliapp.Application):
system = self._find_cluster_system(d['systems'], syspath)
system['deploy'][syspath[-1]][key] = val
+ def cmd_chunk_add_install_command(self, (chunk_file, command)):
+ with self._open_yaml(chunk_file) as chunk:
+ if not 'install-commands' in chunk:
+ chunk['install-commands'] = []
+ chunk['install-commands'].append(command)
diff --git a/yarns/building.yarn b/yarns/building.yarn
index 6b90ce6..feb955f 100644
--- a/yarns/building.yarn
+++ b/yarns/building.yarn
@@ -7,3 +7,44 @@ Morph Building Tests
WHEN the user checks out the system branch called master
AND the user creates an uncommitted system morphology called systems/base-system.morph for our architecture in system branch master
THEN morph build the system systems/base-system.morph of the branch master
+Chunk morphologies in definitions
+Chunk morphologies can either be in the source code repository for the
+chunk or in the definitions repository. All the other tests which build
+things are currently testing that chunk morphologies in the source
+repository works, but here we test that building with a chunk morphology
+in the definitions repository works correctly.
+ SCENARIO building a system with a chunk whose morphology is in the definitions repo
+ GIVEN a workspace
+ AND a git server
+A chunk morphology is added to the definitions repository, and the
+stratum is changed so that the chunk spec points to this morphology.
+ WHEN the user checks out the system branch called master
+ GIVEN a chunk morphology called test-chunk.morph in system branch master with install-command install -D -m 644 /dev/null "$DESTDIR/$PREFIX/chunks-in-definitions"
+ AND the chunk spec test-chunk in the stratum strata/test-stratum.morph in branch master has morph set to test-chunk.morph
+The system needs to be built to ensure that we can successfully build
+using a chunk morphology that is in the definitions repository.
+ WHEN the user builds the system systems/test-system.morph in branch master
+The system needs to be deployed as a tarball in order to ensure the
+chunk morphology from the definitions repository was used.
+ GIVEN a cluster called test-cluster.morph in system branch master
+ AND a system in cluster test-cluster.morph in branch master called test-system
+ AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch master has deployment type: tar
+ AND system test-system in cluster test-cluster.morph in branch master has deployment location: test.tar
+ WHEN the user attempts to deploy the cluster test-cluster.morph in branch master
+ THEN morph succeeded
+If the correct chunk morphology was used, then the tarball should
+contain the file "/usr/chunks-in-definitions".
+ THEN tarball workspace/master/test/morphs/test.tar contains usr/chunks-in-definitions
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index d32bfd6..e670e50 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -820,6 +820,15 @@ Altering morphologies in their source repositories
Altering morphologies in the workspace
+### Altering chunks ###
+ IMPLEMENTS GIVEN a chunk morphology called (\S+) in system branch (\S+) with (\S+) (.+)
+ name="$MATCH_1"
+ branch="$MATCH_2"
+ cp "$DATADIR/gits/test-chunk/test-chunk.morph" "$DATADIR/workspace/$branch/test/morphs/$name"
+ "$SRCDIR/scripts/edit-morph" "chunk-add-$MATCH_3" \
+ "$DATADIR/workspace/$branch/test/morphs/$name" "$MATCH_4"
### Altering strata ###
IMPLEMENTS GIVEN stratum (\S+) in system branch (\S+) has match rules: (.*)
@@ -827,6 +836,11 @@ Altering morphologies in the workspace
"$SRCDIR/scripts/edit-morph" set-stratum-match-rules \
"$MATCH_1" "$MATCH_3"
+ IMPLEMENTS GIVEN the chunk spec (\S+) in the stratum (\S+) in branch (\S+) has (\S+) set to (\S+)
+ cd "$DATADIR/workspace/$MATCH_3/test/morphs"
+ "$SRCDIR/scripts/edit-morph" edit-chunk-spec \
+ "$MATCH_1" "$MATCH_2" "$MATCH_4" "$MATCH_5"
### Altering clusters ###
IMPLEMENTS GIVEN a cluster called (\S+) in system branch (\S+)