From 871504484a7fab96de57885d3c12a1c2129cc75f Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 16 Oct 2017 17:16:43 +0300 Subject: Add: yarn scenario for managing workers --- yarns/300-workers.yarn | 159 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 yarns/300-workers.yarn (limited to 'yarns/300-workers.yarn') diff --git a/yarns/300-workers.yarn b/yarns/300-workers.yarn new file mode 100644 index 0000000..473dd29 --- /dev/null +++ b/yarns/300-workers.yarn @@ -0,0 +1,159 @@ + + +# Controller worker management + +The Ick2 controller manages information about workers. Workers are +things that actually do the builds. A worker is described by a resource +like this: + + EXAMPLE project resource + { + "worker": "obelix", + "protocol": "ssh", + "address": "obelix.ick.example.com", + "user": "ick", + "keywords": { + "debian_release": "debian9", + "debian_codename": "stretch", + "debian_arch": "amd64" + } + } + +In other words, there are several things that define a worker: + +* The name, in the `worker` field. This is used for referreing to the + project in the API. +* Information for how to access the worker from the outside. The + worker manager needs this, in case it's running on a different host + from the worker. +* Some keywords to describe the worker. The controller will use this + to pick the appropriate worker to give a build to. + +## Managing workers + +Note that this only tests managing information about workers via the +controller API. It doesn't actually talk to the worker itself. + + SCENARIO managing workers + GIVEN an RSA key pair for token signing + AND an access token for scopes + ... uapi_workers_get + ... uapi_workers_post + ... uapi_workers_id_get + ... uapi_workers_id_put + ... uapi_workers_id_delete + AND controller config uses statedir at the state directory + AND a running ick controller + + WHEN user makes request GET /workers + THEN result has status code 200 + AND body matches { "projects": [] } + + WHEN user makes request POST /workers + ... { + ... "workers": "obelix", + ... "protocol": "ssh", + ... "address": "obelix.ick.example", + ... "user": "ick", + ... "keywords": { + ... "debian_codename": "stretch" + ... } + ... } + THEN result has status code 201 + AND body matches + ... { + ... "workers": "obelix", + ... "protocol": "ssh", + ... "address": "obelix.ick.example", + ... "user": "ick", + ... "keywords": { + ... "debian_codename": "stretch" + ... } + ... } + AND controller state directory contains worker obelix + + WHEN user makes request GET /workers + THEN result has status code 200 + AND body matches + ... { + ... "projects": [ + ... { + ... "workers": "obelix", + ... "protocol": "ssh", + ... "address": "obelix.ick.example", + ... "user": "ick", + ... "keywords": { + ... "debian_codename": "stretch" + ... } + ... } + ... ] + ... } + + WHEN user stops ick controller + GIVEN a running ick controller + WHEN user makes request GET /workers/obelix + THEN result has status code 200 + AND body matches + ... { + ... "workers": "obelix", + ... "protocol": "ssh", + ... "address": "obelix.ick.example", + ... "user": "ick", + ... "keywords": { + ... "debian_codename": "stretch" + ... } + ... } + + WHEN user makes request PUT /workers/obelix + ... { + ... "workers": "obelix", + ... "protocol": "local", + ... "keywords": { + ... "debian_codename": "unstable" + ... } + ... } + THEN result has status code 200 + AND body matches + ... { + ... "workers": "obelix", + ... "protocol": "local", + ... "keywords": { + ... "debian_codename": "unstable" + ... } + ... } + AND controller state directory contains worker obelix + + WHEN user makes request GET /workers/obelix + THEN result has status code 200 + AND body matches + ... { + ... "workers": "obelix", + ... "protocol": "local", + ... "keywords": { + ... "debian_codename": "unstable" + ... } + ... } + + WHEN user makes request DELETE /workers/obelix + THEN result has status code 200 + WHEN user makes request GET /workers/obelix + THEN result has status code 404 + + FINALLY stop ick controller -- cgit v1.2.1