diff options
Diffstat (limited to 'yarns.webapp/060-validation.yarn')
-rw-r--r-- | yarns.webapp/060-validation.yarn | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/yarns.webapp/060-validation.yarn b/yarns.webapp/060-validation.yarn index a66e889..588d875 100644 --- a/yarns.webapp/060-validation.yarn +++ b/yarns.webapp/060-validation.yarn @@ -118,6 +118,50 @@ them to Lorry one by one. In other words: * The `.lorry` file must be valid JSON. * It must be a dict. * Each key must map to another dict. -* Each inner dict must have a key "type", which maps to a string. +* Each inner dict must have a key `type`, which maps to a string. -Everything else is left for Lorry itself. +Everything else is left for Lorry itself. Lorry Controller only needs +to handle Lorry not working, and it already does that. + +Firstly, some setup. + + SCENARIO validate .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 + +Make sure WEBAPP handles there not being any `.lorry` files. + + WHEN admin makes request POST /1.0/read-configuration with dummy=value + THEN response matches "has been updated" + AND STATEDB is empty + +Add a `.lorry` file that contains broken JSON. + + GIVEN Lorry file notjson.lorry with THIS IS NOT JSON + THEN response matches "has been updated" + AND STATEDB is empty + +Add a `.lorry` file that is valid JSON, but is not a dict. + + GIVEN Lorry file notadict.lorry with [1,2,3] + THEN response matches "has been updated" + AND STATEDB is empty + +Add a `.lorry` that is a dict, but doesn't map keys to dicts. + + GIVEN Lorry file notadictofdicts.lorry with { "foo": 1 } + THEN response matches "has been updated" + AND STATEDB is empty + +Add a `.lorry` whose inner dict does not have a `type` field. + + GIVEN Lorry file notadictofdicts.lorry with { "foo": { "bar": "yo" }} + THEN response matches "has been updated" + AND STATEDB is empty + +Clean up at the end. + + FINALLY WEBAPP terminates |