summaryrefslogtreecommitdiff
path: root/yarns.webapp
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-22 16:50:18 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-22 16:50:18 +0000
commitca8eaccfd8c0d89c91873dbfe4f5d33d479d2913 (patch)
tree54f30c0282eba421ee720bafd23e0bfe1f8d61ff /yarns.webapp
parent34483de76d310031525821ef56b03110fc09ef7a (diff)
downloadlorry-controller-ca8eaccfd8c0d89c91873dbfe4f5d33d479d2913.tar.gz
Add scenario for testing that loading broken lorries is OKbaserock/liw/new-lc-2
Diffstat (limited to 'yarns.webapp')
-rw-r--r--yarns.webapp/060-validation.yarn47
1 files changed, 47 insertions, 0 deletions
diff --git a/yarns.webapp/060-validation.yarn b/yarns.webapp/060-validation.yarn
index 91b3b54..040f6cd 100644
--- a/yarns.webapp/060-validation.yarn
+++ b/yarns.webapp/060-validation.yarn
@@ -188,3 +188,50 @@ broken ones too.
Clean up at the end.
FINALLY WEBAPP terminates
+
+
+Load broken Lorry files
+-----------------------
+
+This scenario checks that if STATEDB already contains a valid Lorry
+file, and we're trying to load an invalid one, then the valid one
+doesn't get overwritten or discarded.
+
+First, some setup.
+
+ SCENARIO load broken .lorry files
+ GIVEN a new git repository in CONFGIT
+ AND an empty lorry-controller.conf in CONFGIT
+ AND lorry-controller.conf in CONFGIT adds lorries *.lorry using prefix upstream
+ AND WEBAPP uses CONFGIT as its configuration directory
+ AND a running WEBAPP
+
+Add a `.lorry` file that contains valid JSON.
+
+ GIVEN Lorry file CONFGIT/a-ok.lorry with { "foo": { "type": "git", "url": "git://example.com/foo" }}
+ WHEN admin makes request POST /1.0/read-configuration
+ THEN response matches "has been updated"
+
+Make sure it's the one we loaded.
+
+ WHEN admin makes request GET /1.0/list-queue
+ THEN response has queue set to ["upstream/foo"]
+ WHEN admin makes request GET /1.0/lorry/upstream/foo
+ THEN response matches "git://example.com/foo"
+
+Now, add a broken file and try to load that.
+
+ GIVEN Lorry file CONFGIT/notjson.lorry with THIS IS NOT JSON
+ WHEN admin makes request POST /1.0/read-configuration
+ THEN response matches "has been updated"
+
+Now, make sure we still have what we originally had.
+
+ WHEN admin makes request GET /1.0/list-queue
+ THEN response has queue set to ["upstream/foo"]
+ WHEN admin makes request GET /1.0/lorry/upstream/foo
+ THEN response matches "git://example.com/foo"
+
+Clean up at the end.
+
+ FINALLY WEBAPP terminates