diff options
-rw-r--r-- | yarns.webapp/060-validation.yarn | 47 |
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 |