summaryrefslogtreecommitdiff
path: root/yarns/300-workers.yarn
diff options
context:
space:
mode:
Diffstat (limited to 'yarns/300-workers.yarn')
-rw-r--r--yarns/300-workers.yarn159
1 files changed, 159 insertions, 0 deletions
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 @@
+<!--
+
+Copyright 2017 Lars Wirzenius
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+-->
+
+# 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