summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-09-13 13:04:59 +0300
committerLars Wirzenius <liw@liw.fi>2015-09-13 13:07:06 +0300
commit5d01025987335ee78917e3fffe94d38fe3496ef7 (patch)
treed8c241a4250b87cc57795a547d7535b8e16d4ad0 /yarns
parent931e5cf18cf2e5440963f5da6f14fac713ee26c2 (diff)
downloadansibleness-5d01025987335ee78917e3fffe94d38fe3496ef7.tar.gz
Add scenario for testing an ick worker
Diffstat (limited to 'yarns')
-rw-r--r--yarns/200-ick-workers.yarn35
-rw-r--r--yarns/900-implements.yarn36
2 files changed, 71 insertions, 0 deletions
diff --git a/yarns/200-ick-workers.yarn b/yarns/200-ick-workers.yarn
new file mode 100644
index 0000000..fe78278
--- /dev/null
+++ b/yarns/200-ick-workers.yarn
@@ -0,0 +1,35 @@
+# Ick workers for my CI system
+
+Ick is my CI program. It needs workers on which it runs builds. These
+need to be accessible over ssh, and the remote user must have
+passwordless sudo access to run pbuilder.
+
+I have a number of the ick workers. Yarn does not provide a looping
+construct or parameterised scenarios. However, since they are all
+maintained using Ansible, and should thus be identical, I avoid having
+to repeat the scenario for each worker by just blindly assuming that
+if one works, they all work.
+
+ SCENARIO ick workers can build packages
+
+Basic checks.
+
+ GIVEN server name is ick-debian8-amd64
+ AND server has account ick
+ THEN server responds to ping
+ AND server hostname is as expected
+ AND server account has sudo
+
+Do a test build of the Debian hello package.
+
+ GIVEN a remote temporary directory to use
+ AND a directory RESULT on the server
+ WHEN server runs apt-get source --download-only hello
+ WHEN server runs test -e *.dsc
+ WHEN server runs sudo pbuilder --build --buildresult RESULT
+ ... --basetgz /var/cache/pbuilder/release.tgz hello_2.9-2+deb8u1.dsc
+ THEN remote files RESULT/*.deb exist
+
+Cleanup.
+
+ FINALLY remove remote temporary directory
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn
index 57f52aa..26a05a7 100644
--- a/yarns/900-implements.yarn
+++ b/yarns/900-implements.yarn
@@ -83,3 +83,39 @@ The stdout, stderr, and exit code have been saved. Inspect them.
IMPLEMENTS THEN output matches (.+)
cat "$DATADIR/stdout"
grep "$MATCH_1" "$DATADIR/stdout"
+
+## Manage a remote temporary directory
+
+Whenever we need to do anything that takes more than one step, we'll
+need a temporary directory in which to work. This is similar to the
+`DATADIR` that yarn provides us on the local machine.
+
+ IMPLEMENTS GIVEN a remote temporary directory to use
+ . "$DATADIR/config.sh"
+ name="$(ssh "$ACCOUNT@$SERVER" mktemp -d)"
+ echo "REMOTETMP=$name" >> "$DATADIR/config.sh"
+
+ IMPLEMENTS FINALLY remove remote temporary directory
+ # FIXME: The following will fail if REMOTETMP contains shell's
+ # magic characters or whitespace. Ugh.
+ . "$DATADIR/config.sh"
+ ssh "$ACCOUNT@$SERVER" rm -rf "$REMOTETMP"
+
+## Create remote directory
+
+ IMPLEMENTS GIVEN a directory (\S+) on the server
+ . "$DATADIR/config.sh"
+ run_remotely "$ACCOUNT@$SERVER" "$REMOTETMP" "mkdir $MATCH_1"
+
+## Check for files on the remote end
+
+ IMPLEMENTS THEN remote files (\S+) exist
+ . "$DATADIR/config.sh"
+ run_remotely "$ACCOUNT@$SERVER" "$REMOTETMP" "ls -d $MATCH_1" |
+ grep .
+
+## Run a command on the server
+
+ IMPLEMENTS WHEN server runs (.+)
+ . "$DATADIR/config.sh"
+ run_remotely "$ACCOUNT@$SERVER" "$REMOTETMP" "$MATCH_1"