summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2014-05-23 16:28:21 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2014-05-27 08:53:20 +0000
commit10130eae94d567a27d5b34410314f2a68b0fa352 (patch)
tree20bb526f59acc0bc21633e314ef2d5027a162535
parent5ac9f64b96853cba4d6b8d9f631e3701eb671558 (diff)
downloadmorph-baserock/adamcoldrick/deploy-specific-systems-v3.tar.gz
Add yarn tests for new deployment functionalitybaserock/adamcoldrick/deploy-specific-systems-v3
-rw-r--r--yarns/deployment.yarn67
-rw-r--r--yarns/implementations.yarn3
2 files changed, 70 insertions, 0 deletions
diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn
index fc21b826..b51645c6 100644
--- a/yarns/deployment.yarn
+++ b/yarns/deployment.yarn
@@ -102,3 +102,70 @@ 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
+
+Partial deployments
+===================
+
+Deploy part of a cluster
+------------------------
+
+We may not always want to deploy every system in a cluster, for example
+if we only want to deploy a distbuild controller but we have a cluster
+for a full network.
+
+ SCENARIO partially 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 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
+
+We now want to add a second system to the cluster, so we can choose
+which one to deploy.
+
+ GIVEN a system in cluster test-cluster in branch master called second-system
+ AND system second-system in cluster test-cluster in branch master builds second-system
+ AND system second-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 test-system.location="$DATADIR/test-system.tar" second-system.location="$DATADIR/second-system.tar"
+ THEN morph succeeded
+
+Morph succeeding alone does not satisfy the requirements of this test.
+It may have deployed both systems, or the wrong system, so we need to
+make sure only the correct tarball exists.
+
+ THEN file test-system.tar exists
+ AND file second-system.tar does not exist
+
+Deploy all of a multi-system cluster
+------------------------------------
+
+We should also test that not specifying a system deploys both systems.
+
+ SCENARIO deploying a cluster morphology that contains multiple 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
+
+We now want to add a second system deployment to the cluster, so we can
+choose which one to deploy.
+
+ GIVEN a system in cluster test-cluster in branch master called second-system
+ AND system second-system in cluster test-cluster in branch master builds test-system
+ AND system second-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-system.tar" second-system.location="$DATADIR/second-system.tar"
+ THEN morph succeeded
+
+We should also check that both systems were deployed as expected.
+
+ THEN file test-system.tar exists
+ AND file second-system.tar exists
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index e4f36399..7d52a06d 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -720,6 +720,9 @@ Check attributes of a file on the filesystem
IMPLEMENTS THEN file (\S+) exists
test -e "$DATADIR/$MATCH_1"
+ IMPLEMENTS THEN file (\S+) does not exist
+ test ! -e "$DATADIR/$MATCH_1"
+
IMPLEMENTS THEN file (\S+) has permissions (\S+)
stat -c %A "$DATADIR/$MATCH_1" | grep -Fx -e "$MATCH_2"