summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2014-09-24 20:37:29 +0000
committerRichard Maw <richard.maw@gmail.com>2014-10-01 09:30:15 +0000
commit54c81674db48d5c9eb151199ef1bc434fd1bd4a6 (patch)
treee885fa0240b83ef70eafa1a49a99538e13abde14
parent6b28a2798c0ad938c4d365404ad2812b610b5b23 (diff)
downloadmorph-54c81674db48d5c9eb151199ef1bc434fd1bd4a6.tar.gz
Move the branch-from-image test to a yarn
-rwxr-xr-xtests.as-root/branch-from-image-works.script57
l---------tests.as-root/branch-from-image-works.setup1
-rw-r--r--tests.as-root/branch-from-image-works.stdout1
-rw-r--r--yarns/deployment.yarn45
-rw-r--r--yarns/implementations.yarn4
5 files changed, 49 insertions, 59 deletions
diff --git a/tests.as-root/branch-from-image-works.script b/tests.as-root/branch-from-image-works.script
deleted file mode 100755
index fb0b09c9..00000000
--- a/tests.as-root/branch-from-image-works.script
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2013-2014 Codethink Limited
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-# A branch created with branch-from-image has the right commits specified
-
-set -eu
-
-# Disable test on versions of Python before 2.7.
-. "$SRCDIR/scripts/python-check"
-
-. "$SRCDIR/scripts/fix-committer-info"
-
-tar=$("$SRCDIR/scripts/test-morph" --find-system-artifact \
- build-morphology test:morphs tarball hello-tarball)
-
-extracted="$DATADIR/extracted"
-mkdir -p "$extracted"
-tar -xf "$tar" -C "$extracted"
-get_sha1(){
- sed -nre '/sha1/s/^.*([0-9a-f]{40}).*$/\1/p' "$1"
-}
-hello_chunk_commit=$(get_sha1 "$extracted/baserock/hello-bins.meta")
-
-# Make a commit so that petrifying from HEAD is detectable
-chunkrepo="$DATADIR/chunk-repo"
-cd "$chunkrepo"
-git checkout --quiet farrokh
-sed -i -e 's/hello, world/goodbye, world/g' hello.c
-git add hello.c
-git commit --quiet -m 'Make hello say goodbye'
-
-
-workspace="$DATADIR/workspace"
-"$SRCDIR/scripts/test-morph" init "$workspace"
-cd "$workspace"
-"$SRCDIR/scripts/test-morph" branch-from-image mybranch \
- --metadata-dir="$extracted/baserock"
-cd mybranch/test/morphs
-grep -qFe "$hello_chunk_commit" hello-stratum.morph
-tar=$("$SRCDIR/scripts/test-morph" --find-system-artifact build hello-tarball)
-tar -xf "$tar" bin/hello
-bin/hello
diff --git a/tests.as-root/branch-from-image-works.setup b/tests.as-root/branch-from-image-works.setup
deleted file mode 120000
index aac6926a..00000000
--- a/tests.as-root/branch-from-image-works.setup
+++ /dev/null
@@ -1 +0,0 @@
-metadata-includes-morph-version.setup \ No newline at end of file
diff --git a/tests.as-root/branch-from-image-works.stdout b/tests.as-root/branch-from-image-works.stdout
deleted file mode 100644
index 4b5fa637..00000000
--- a/tests.as-root/branch-from-image-works.stdout
+++ /dev/null
@@ -1 +0,0 @@
-hello, world
diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn
index 40b50432..0782c7c1 100644
--- a/yarns/deployment.yarn
+++ b/yarns/deployment.yarn
@@ -283,3 +283,48 @@ deployment.
WHEN the user attempts to deploy test-system.sysroot from cluster test-cluster.morph in branch master
THEN morph failed
FINALLY the git server is shut down
+
+Deploying branch-from-image produced systems
+============================================
+
+We have this nifty subcommand called branch-from-image, which can be
+used to build the same thing as an existing image.
+
+There's no special requirements for making the image reproducible.
+
+ SCENARIO reproducing systems
+ 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
+ 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: sysroot
+ AND system test-system in cluster test-cluster.morph in branch master has deployment location: test-system
+ WHEN the user attempts to deploy the cluster test-cluster.morph in branch master
+ THEN morph succeeded
+ AND file workspace/master/test/morphs/test-system exists
+
+To reproduce an existing image, do a checkout with the extracted root
+filesystem's /baserock directory as the `--metadata-dir` argument.
+
+ WHEN the user attempts to check out the system branch from workspace/master/test/morphs/test-system called mybranch
+ THEN morph succeeded
+ AND the system branch mybranch is checked out
+
+After it is checked-out, the system can be rebuilt.
+
+ WHEN the user attempts to build the system systems/test-system.morph in branch mybranch
+ THEN morph succeeded
+
+Once it is rebuilt, it can be deployed.
+
+ GIVEN a cluster called test-cluster.morph in system branch mybranch
+ AND a system in cluster test-cluster.morph in branch mybranch called test-system
+ AND system test-system in cluster test-cluster.morph in branch mybranch builds systems/test-system.morph
+ AND system test-system in cluster test-cluster.morph in branch mybranch has deployment type: tar
+ AND system test-system in cluster test-cluster.morph in branch mybranch has deployment location: test-system.tar
+ WHEN the user attempts to deploy the cluster test-cluster.morph in branch mybranch
+ THEN morph succeeded
+ AND file workspace/mybranch/test/morphs/test-system.tar exists
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index e99c1817..9cf497fc 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -382,6 +382,10 @@ Attempt to check out a system branch from a root that has no systems.
cd "$DATADIR/workspace"
attempt_morph checkout test:test-chunk master
+ IMPLEMENTS WHEN the user attempts to check out the system branch from (\S+) called (\S+)
+ cd "$DATADIR/workspace"
+ attempt_morph branch-from-image --metadata-dir "$DATADIR/$MATCH_1/baserock" "$MATCH_2"
+
We also need to verify that a system branch has been checked out.
IMPLEMENTS THEN the system branch (\S+) is checked out