summaryrefslogtreecommitdiff
path: root/yarns/400-build.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-02-24 18:04:12 +0200
committerLars Wirzenius <liw@liw.fi>2018-02-24 18:43:27 +0200
commit069f8ba0d24992f310f8a3b4aad95aca4f3ac4f3 (patch)
treecd1d212828c5186f365e6f6dc3cbb5e7b01c3082 /yarns/400-build.yarn
parentde3e04a8a08f7bb2f6ca5ba8aaa636f47e67afa1 (diff)
downloadick2-069f8ba0d24992f310f8a3b4aad95aca4f3ac4f3.tar.gz
Add: scenario for building concurrently
Diffstat (limited to 'yarns/400-build.yarn')
-rw-r--r--yarns/400-build.yarn185
1 files changed, 185 insertions, 0 deletions
diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn
index 5de9768..f818e95 100644
--- a/yarns/400-build.yarn
+++ b/yarns/400-build.yarn
@@ -785,3 +785,188 @@ Build second project.
Finish up.
FINALLY stop ick controller
+
+
+# Build two projects concurrently
+
+This scenario tests the controller API to simulate a build.
+
+ SCENARIO build two projects concurrently
+
+Set up the controller.
+
+ GIVEN an RSA key pair for token signing
+ AND controller config uses statedir at the state directory
+ AND controller config uses https://blobs.example.com as blob service
+ 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 couple of workers.
+
+ GIVEN an access token for asterix with scopes
+ ... uapi_workers_post
+ ... uapi_work_post
+ ... uapi_work_id_get
+ WHEN asterix makes request POST /workers with a valid token and body
+ ... {
+ ... "worker": "asterix"
+ ... }
+ THEN result has status code 201
+
+ GIVEN an access token for obelix with scopes
+ ... uapi_workers_post
+ ... uapi_work_post
+ ... uapi_work_id_get
+ WHEN obelix makes request POST /workers with a valid token and body
+ ... {
+ ... "worker": "obelix"
+ ... }
+ THEN result has status code 201
+
+Trigger both projects.
+
+ 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 user makes request PUT /projects/second/pipelines/do_something
+ ... with a valid token and body { "status": "triggered" }
+ THEN result has status code 200
+
+ WHEN user requests list of builds
+ THEN the list of builds is []
+
+ WHEN asterix makes request GET /work/asterix
+ THEN result is step
+ ... {
+ ... "action": "create_workspace"
+ ... }
+
+ WHEN user requests list of builds
+ THEN the list of builds is ["first/1"]
+
+ WHEN obelix makes request GET /work/obelix
+ THEN result is step
+ ... {
+ ... "action": "create_workspace"
+ ... }
+
+ WHEN user requests list of builds
+ THEN the list of builds is ["first/1", "second/1"]
+
+ WHEN asterix makes request POST /work with a valid token and body
+ ... {
+ ... "build_id": "first/1",
+ ... "worker": "asterix",
+ ... "project": "first",
+ ... "pipeline": "do_something",
+ ... "exit_code": 0,
+ ... "stdout": "",
+ ... "stderr": "",
+ ... "timestamp": "2017-10-27T17:08:49"
+ ... }
+ THEN result has status code 201
+
+ WHEN asterix makes request GET /work/asterix
+ THEN result is step
+ ... {
+ ... "shell": "something"
+ ... }
+
+ WHEN obelix makes request GET /work/obelix
+ THEN result is step
+ ... {
+ ... "action": "create_workspace"
+ ... }
+
+ WHEN obelix makes request POST /work with a valid token and body
+ ... {
+ ... "build_id": "second/1",
+ ... "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 obelix makes request GET /work/obelix
+ THEN result is step
+ ... {
+ ... "shell": "something"
+ ... }
+
+ WHEN asterix makes request POST /work with a valid token and body
+ ... {
+ ... "build_id": "first/1",
+ ... "worker": "asterix",
+ ... "project": "first",
+ ... "pipeline": "do_something",
+ ... "exit_code": 0,
+ ... "stdout": "",
+ ... "stderr": "",
+ ... "timestamp": "2017-10-27T17:08:49"
+ ... }
+ THEN result has status code 201
+
+ WHEN asterix makes request GET /work/asterix
+ THEN body matches {}
+
+ WHEN obelix makes request POST /work with a valid token and body
+ ... {
+ ... "build_id": "second/1",
+ ... "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 obelix makes request GET /work/obelix
+ THEN body matches {}
+
+ WHEN user requests list of builds
+ THEN the list of builds is ["first/1", "second/1"]
+
+Finish up.
+
+ FINALLY stop ick controller