summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-03-10 16:06:29 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2014-03-14 10:54:55 +0000
commit439f278b2048ef20f7b0f953ed45feed50d73120 (patch)
tree362d1171262955a03179e0d83816cc3371f7a94c
parent8fd1da1a64fc48ccb070bcc52766a547c85cbecc (diff)
downloadmorph-439f278b2048ef20f7b0f953ed45feed50d73120.tar.gz
Test nested deployments
-rw-r--r--yarns/deployment.yarn70
-rw-r--r--yarns/implementations.yarn75
-rw-r--r--yarns/regression.yarn5
-rw-r--r--yarns/splitting.yarn5
4 files changed, 125 insertions, 30 deletions
diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn
index c8bfc68f..a5da8ee5 100644
--- a/yarns/deployment.yarn
+++ b/yarns/deployment.yarn
@@ -13,9 +13,13 @@ Morph Deployment Tests
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
+ GIVEN a cluster called test-cluster in system branch master
+ AND a system in cluster test-cluster in branch master called test-system
+ AND system test-system in cluster test-cluster in branch master builds test-system
+ AND system test-system in cluster test-cluster in branch master has deployment type: tar
+ AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
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 test-system.location=test.tar
+ AND the user attempts to deploy the cluster test-cluster in branch master
THEN morph succeeded
Some deployment types support upgrades, but some do not and Morph needs to make
@@ -25,9 +29,13 @@ this clear.
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
+ GIVEN a cluster called test-cluster in system branch master
+ AND a system in cluster test-cluster in branch master called test-system
+ AND system test-system in cluster test-cluster in branch master builds test-system
+ AND system test-system in cluster test-cluster in branch master has deployment type: tar
+ AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
WHEN the user builds the system test-system in branch master
- AND the user attempts to upgrade the cluster test-cluster in branch master with options test-system.location=test.tar
+ AND the user attempts to upgrade the cluster test-cluster in branch master
THEN morph failed
The rawdisk write extension supports both initial deployment and subsequent
@@ -40,9 +48,57 @@ the same code paths as a real upgrade.
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 rawdisk in system branch master
+ GIVEN a cluster called test-cluster in system branch master
+ AND a system in cluster test-cluster in branch master called test-system
+ AND system test-system in cluster test-cluster in branch master builds test-system
+ AND system test-system in cluster test-cluster in branch master has deployment type: rawdisk
+ AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
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 test-system.location=test.img test-system.DISK_SIZE=10M test-system.VERSION_LABEL=test1
+ AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.DISK_SIZE=10M test-system.VERSION_LABEL=test1
THEN morph succeeded
- WHEN the user attempts to upgrade the cluster test-cluster in branch master with options test-system.location=test.img test-system.VERSION_LABEL=test2
+ WHEN the user attempts to upgrade the cluster test-cluster in branch master with options test-system.VERSION_LABEL=test2
THEN morph succeeded
+
+Nested deployments
+==================
+
+For the use-cases of:
+
+1. Installer CD/USB
+2. NFS/VM host
+3. System with multiple containerised applications
+4. System with a toolchain targetting the sysroot of another target
+5. Any nested combination of the above
+
+It is convenient to be able to deploy one system inside another.
+
+ SCENARIO deploying a cluster morphology with nested systems
+ GIVEN a workspace
+ AND a git server
+ WHEN the user checks out the system branch called master
+ GIVEN a cluster called test-cluster in system branch master
+ AND a system in cluster test-cluster in branch master called test-system
+ AND system test-system in cluster test-cluster in branch master builds test-system
+ AND system test-system in cluster test-cluster in branch master has deployment type: tar
+
+After the usual setup, we also add a subsystem to the cluster.
+
+ GIVEN a subsystem in cluster test-cluster in branch master called test-system.sysroot
+ AND subsystem test-system.sysroot in cluster test-cluster in branch master builds test-system
+ AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment type: sysroot
+
+We specify the location as a file path, this is relative to the parent
+system's extracted rootfs, before it is configured.
+
+ AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment location: var/lib/sysroots/test-system
+ 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 test-system.location="$DATADIR/test.tar"
+ THEN morph succeeded
+
+Morph succeeding alone is not sufficient to check whether it actually
+worked, since if it ignored the subsystems field, or got the location
+wrong for the subsystem. To actually test it, we have to check that our
+deployed system contains the other. Since the baserock directory is in
+every system, we can check for that.
+
+ AND tarball test.tar contains var/lib/sysroots/test-system/baserock
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index 71a782f3..e4f36399 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -675,27 +675,6 @@ them, so they can be added to the end of the implements section.
if [ $MATCH_1 == "upgrades" ]; then run_morph "$@"
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
===================================================
@@ -817,7 +796,61 @@ Altering morphologies in their source repositories
Altering morphologies in the workspace
--------------------------------------
+### Altering strata ###
+
IMPLEMENTS GIVEN stratum (\S+) in system branch (\S+) has match rules: (.*)
cd "$DATADIR/workspace/$MATCH_2/test/morphs"
"$SRCDIR/scripts/edit-morph" set-stratum-match-rules \
"$MATCH_1.morph" "$MATCH_3"
+
+### Altering clusters ###
+
+ IMPLEMENTS GIVEN a cluster called (\S+) in system branch (\S+)
+ name="$MATCH_1"
+ branch="$MATCH_2"
+ "$SRCDIR/scripts/edit-morph" cluster-init \
+ "$DATADIR/workspace/$branch/test/morphs/$name.morph"
+
+ IMPLEMENTS GIVEN a (sub)?system in cluster (\S+) in branch (\S+) called (\S+)
+ cluster="$MATCH_2"
+ branch="$MATCH_3"
+ name="$MATCH_4"
+ "$SRCDIR/scripts/edit-morph" cluster-system-init \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name"
+
+ IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) builds (\S+)
+ name="$MATCH_2"
+ cluster="$MATCH_3"
+ branch="$MATCH_4"
+ morphology="$MATCH_5"
+ "$SRCDIR/scripts/edit-morph" cluster-system-set-morphology \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \
+ "$morphology"
+
+ IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment type: (\S+)
+ name="$MATCH_2"
+ cluster="$MATCH_3"
+ branch="$MATCH_4"
+ type="$MATCH_5"
+ "$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-type \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \
+ "$type"
+
+ IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment location: (\S+)
+ name="$MATCH_2"
+ cluster="$MATCH_3"
+ branch="$MATCH_4"
+ location="$MATCH_5"
+ "$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-location \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \
+ "$location"
+
+ IMPLEMENTS GIVEN (sub)?system (\S+) in cluster (\S+) in branch (\S+) has deployment variable: ([^=]+)=(.*)
+ name="$MATCH_2"
+ cluster="$MATCH_3"
+ branch="$MATCH_4"
+ key="$MATCH_5"
+ val="$MATCH_6"
+ "$SRCDIR/scripts/edit-morph" cluster-system-set-deploy-variable \
+ "$DATADIR/workspace/$branch/test/morphs/$cluster.morph" "$name" \
+ "$key" "$val"
diff --git a/yarns/regression.yarn b/yarns/regression.yarn
index 17e3ad87..b0f4d112 100644
--- a/yarns/regression.yarn
+++ b/yarns/regression.yarn
@@ -58,7 +58,10 @@ source it depended on.
AND system test-system uses test-stratum-runtime from test-stratum
AND stratum test-stratum has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|locale)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|misc)]}]
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
+ GIVEN a cluster called test-cluster in system branch master
+ AND a system in cluster test-cluster in branch master called test-system
+ AND system test-system in cluster test-cluster in branch master builds test-system
+ AND system test-system in cluster test-cluster in branch master has deployment type: tar
WHEN the user builds the system test-system in branch master
GIVEN stratum test-stratum in system branch master has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|misc)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|locale)]}]
WHEN the user builds the system test-system in branch master
diff --git a/yarns/splitting.yarn b/yarns/splitting.yarn
index a1b5e565..ee587e11 100644
--- a/yarns/splitting.yarn
+++ b/yarns/splitting.yarn
@@ -47,7 +47,10 @@ The best way to test that only using some stratum artifacts works is
to check which files the output has, so we deploy a tarball and inspect
its contents.
- GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master
+ GIVEN a cluster called test-cluster in system branch master
+ AND a system in cluster test-cluster in branch master called test-system
+ AND system test-system in cluster test-cluster in branch master builds test-system
+ AND system test-system in cluster test-cluster in branch master has deployment type: tar
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 test-system.location="$DATADIR/test.tar"