summaryrefslogtreecommitdiff
path: root/yarns/400-build.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-01-19 17:29:47 +0200
committerLars Wirzenius <liw@liw.fi>2018-01-19 17:29:47 +0200
commit3bc16ac24091009e73d9c4b9c2fbda0cdca6cff5 (patch)
treeee7530bbb5128a369e104ec547ca05f666f54941 /yarns/400-build.yarn
parent7eb210040641c1fd77c0ff9a71260915ecb8bf11 (diff)
downloadick2-3bc16ac24091009e73d9c4b9c2fbda0cdca6cff5.tar.gz
Add: yarn scenario for building two project sequentially
Diffstat (limited to 'yarns/400-build.yarn')
-rw-r--r--yarns/400-build.yarn156
1 files changed, 156 insertions, 0 deletions
diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn
index f30e942..9ccb7ae 100644
--- a/yarns/400-build.yarn
+++ b/yarns/400-build.yarn
@@ -621,3 +621,159 @@ Start build again. This should become build number 2.
... }
FINALLY stop ick controller
+
+
+# Build two projects sequentially
+
+This scenario tests the controller API to simulate a build.
+
+ SCENARIO build two projects sequentially
+
+Set up the controller.
+
+ GIVEN an RSA key pair for token signing
+ AND controller config uses statedir at the state directory
+ AND an access token for user with scopes
+ ... uapi_pipelines_post
+ ... uapi_projects_post
+ ... uapi_projects_id_pipelines_id_put
+ ... uapi_projects_id_pipelines_id_get
+ ... uapi_projects_id_builds_get
+ ... uapi_workers_id_get
+ ... uapi_builds_get
+ ... uapi_builds_id_get
+ ... uapi_logs_id_get
+ AND a running ick controller
+
+Add a couple of projects.
+
+ WHEN user makes request POST /pipelines with a valid token and body
+ ... {
+ ... "pipeline": "do_something",
+ ... "actions": [
+ ... { "shell": "something" }
+ ... ]
+ ... }
+ THEN result has status code 201
+ WHEN user makes request POST /projects with a valid token and body
+ ... {
+ ... "project": "first",
+ ... "pipelines": ["do_something"]
+ ... }
+ THEN result has status code 201
+ WHEN user makes request POST /projects with a valid token and body
+ ... {
+ ... "project": "second",
+ ... "pipelines": ["do_something"]
+ ... }
+ THEN result has status code 201
+
+Register a worker.
+
+ GIVEN an access token for worker-manager with scopes
+ ... uapi_workers_post
+ ... uapi_work_post
+ ... uapi_work_id_get
+ WHEN worker-manager makes request POST /workers with a valid token and body
+ ... {
+ ... "worker": "obelix"
+ ... }
+ THEN result has status code 201
+
+Build the first project.
+
+ WHEN user makes request PUT /projects/first/pipelines/do_something
+ ... with a valid token and body { "status": "triggered" }
+ THEN result has status code 200
+
+ WHEN worker-manager makes request GET /work/obelix
+ THEN result is step
+ ... {
+ ... "action": "create_workspace"
+ ... }
+
+ WHEN worker-manager makes request POST /work with a valid token and body
+ ... {
+ ... "build_id": 1,
+ ... "worker": "obelix",
+ ... "project": "first",
+ ... "pipeline": "do_something",
+ ... "exit_code": 0,
+ ... "stdout": "",
+ ... "stderr": "",
+ ... "timestamp": "2017-10-27T17:08:49"
+ ... }
+ THEN result has status code 201
+
+ WHEN worker-manager makes request GET /work/obelix
+ THEN result is step
+ ... {
+ ... "shell": "something"
+ ... }
+
+ WHEN worker-manager makes request POST /work with a valid token and body
+ ... {
+ ... "build_id": 1,
+ ... "worker": "obelix",
+ ... "project": "first",
+ ... "pipeline": "do_something",
+ ... "exit_code": 0,
+ ... "stdout": "",
+ ... "stderr": "",
+ ... "timestamp": "2017-10-27T17:08:49"
+ ... }
+ THEN result has status code 201
+
+ WHEN user requests list of builds
+ THEN the list of builds is [1]
+
+Build second project.
+
+ WHEN user makes request PUT /projects/second/pipelines/do_something
+ ... with a valid token and body { "status": "triggered" }
+ THEN result has status code 200
+
+ WHEN worker-manager makes request GET /work/obelix
+ THEN result is step
+ ... {
+ ... "action": "create_workspace"
+ ... }
+
+ WHEN worker-manager makes request POST /work with a valid token and body
+ ... {
+ ... "build_id": 2,
+ ... "worker": "obelix",
+ ... "project": "second",
+ ... "pipeline": "do_something",
+ ... "exit_code": 0,
+ ... "stdout": "",
+ ... "stderr": "",
+ ... "timestamp": "2017-10-27T17:08:49"
+ ... }
+ THEN result has status code 201
+
+ WHEN worker-manager makes request GET /work/obelix
+ THEN result is step
+ ... {
+ ... "shell": "something"
+ ... }
+
+ WHEN worker-manager makes request POST /work with a valid token and body
+ ... {
+ ... "build_id": 2,
+ ... "worker": "obelix",
+ ... "project": "second",
+ ... "pipeline": "do_something",
+ ... "exit_code": 0,
+ ... "stdout": "",
+ ... "stderr": "",
+ ... "timestamp": "2017-10-27T17:08:49"
+ ... }
+ THEN result has status code 201
+
+ WHEN user requests list of builds
+ THEN the list of builds is [1, 2]
+
+Finish up.
+
+ FINALLY stop ick controller