diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-06-28 08:00:28 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-07-05 20:59:10 +0300 |
commit | 1fc41ad97411b435c512ba3a0de63929eda9c33d (patch) | |
tree | 753b342e70c5ac2bf64eb619e95f815d47588e0b /yarns/400-build.yarn | |
parent | 1c6d50edf9041055f4804a1ba21a4fc5499bb0a9 (diff) | |
download | ick2-1fc41ad97411b435c512ba3a0de63929eda9c33d.tar.gz |
Change: make yarns run against a remote Ick instance, not local
Diffstat (limited to 'yarns/400-build.yarn')
-rw-r--r-- | yarns/400-build.yarn | 209 |
1 files changed, 144 insertions, 65 deletions
diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index 5172ba0..13eefce 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -1,6 +1,6 @@ <!-- -Copyright 2017-2018 Lars Wirzenius +Copyright 2017-2019 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 @@ -25,20 +25,23 @@ This scenario tests the controller API to simulate a build. 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 artifact store - AND controller config uses https://auth.example.com as authentication - AND controller config uses https://notify.example.com as notify - AND an access token for user with scopes + GIVEN an access token for user with scopes ... uapi_pipelines_post + ... uapi_pipelines_get + ... uapi_pipelines_id_delete ... uapi_projects_post + ... uapi_projects_get + ... uapi_projects_id_delete ... uapi_projects_id_status_put ... uapi_projects_id_status_get ... uapi_projects_id_builds_get + ... uapi_workers_id_delete ... uapi_workers_id_get ... uapi_builds_get + ... uapi_builds_id_delete ... uapi_builds_id_get + ... uapi_logs_get + ... uapi_logs_id_delete ... uapi_logs_id_get AND a running ick controller @@ -105,6 +108,7 @@ Register a worker. ... { ... } THEN result has status code 201 + AND worker id is OBELIX Trigger build of project that doesn't exist. @@ -135,7 +139,7 @@ the worker to construct a new workspace for the build. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -154,7 +158,7 @@ the worker to construct a new workspace for the build. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -168,16 +172,16 @@ the worker to construct a new workspace for the build. User can now see pipeline is running and which worker is building it. - WHEN user makes request GET /workers/obelix + WHEN user makes request GET /workers/${OBELIX} THEN result has status code 200 AND body matches ... { - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "doing": { ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -199,7 +203,7 @@ User can now see pipeline is running and which worker is building it. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "graph": { ... "1": { @@ -238,7 +242,7 @@ Worker reports workspace creation is done. Note the zero exit code. ... { ... "build_id": "rome/1", ... "action_id": "1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": 0, ... "stdout": "", @@ -256,7 +260,7 @@ Worker requests more work, and gets the first actual build step. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -275,7 +279,7 @@ hasn't finished yet. ... { ... "build_id": "rome/1", ... "action_id": "2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": null, ... "stdout": "hey ho", @@ -294,7 +298,7 @@ didn't finish. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -319,7 +323,7 @@ Report the step is done, and successfully. ... { ... "build_id": "rome/1", ... "action_id": "2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": 0, ... "stdout": ", hey ho\n", @@ -344,7 +348,7 @@ The build status now shows the next step as the active one. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -382,7 +386,7 @@ Now there's another step to do. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -396,15 +400,15 @@ Now there's another step to do. User sees changed status. - WHEN user makes request GET /workers/obelix + WHEN user makes request GET /workers/${OBELIX} THEN result has status code 200 AND body matches ... { - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "doing": { ... "build_id": "rome/1", ... "build_number": 1, - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -424,7 +428,7 @@ Report it done. ... { ... "build_id": "rome/1", ... "action_id": "3", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": 0, ... "stdout": "to the gold mine we go!\n", @@ -441,7 +445,7 @@ Worker now gets told to notify about the build. ... { ... "build_id": "rome/1", ... "build_number": 1, - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -459,7 +463,7 @@ Report it's done. ... { ... "build_id": "rome/1", ... "action_id": "4", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": 0, ... "stdout": "", @@ -486,7 +490,7 @@ current action. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -526,7 +530,7 @@ current action. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -575,7 +579,7 @@ Start build again. This should become build number 2. ... "build_id": "rome/2", ... "build_number": 2, ... "log": "/logs/rome/2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -596,7 +600,7 @@ Start build again. This should become build number 2. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -630,7 +634,7 @@ Start build again. This should become build number 2. ... "build_id": "rome/2", ... "build_number": 2, ... "log": "/logs/rome/2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -662,7 +666,7 @@ Start build again. This should become build number 2. ... { ... "build_id": "rome/2", ... "action_id": "1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": 0, ... "stdout": "", @@ -678,7 +682,7 @@ Start build again. This should become build number 2. ... "build_id": "rome/2", ... "build_number": 2, ... "log": "/logs/rome/2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -694,7 +698,7 @@ Start build again. This should become build number 2. ... { ... "build_id": "rome/2", ... "action_id": "2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": 0, ... "stdout": "hey ho", @@ -710,7 +714,7 @@ Start build again. This should become build number 2. ... { ... "build_id": "rome/2", ... "action_id": "3", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": 0, ... "stdout": "hey ho", @@ -725,7 +729,7 @@ Start build again. This should become build number 2. ... { ... "build_id": "rome/2", ... "build_number": 2, - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -741,7 +745,7 @@ Start build again. This should become build number 2. ... { ... "build_id": "rome/2", ... "action_id": "4", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "exit_code": 0, ... "stdout": "", @@ -763,7 +767,7 @@ Start build again. This should become build number 2. ... "build_id": "rome/1", ... "build_number": 1, ... "log": "/logs/rome/1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -797,7 +801,7 @@ Start build again. This should become build number 2. ... "build_id": "rome/2", ... "build_number": 2, ... "log": "/logs/rome/2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "rome", ... "parameters": { ... "foo": "bar" @@ -830,6 +834,29 @@ Start build again. This should become build number 2. ... ] ... } + + WHEN user makes request DELETE /projects/bad_rome + AND user makes request DELETE /projects/rome + AND user makes request DELETE /projects/constantinople + AND user makes request DELETE /pipelines/construct + AND user makes request DELETE /workers/${OBELIX} + AND user makes request DELETE /builds/rome/1 + AND user makes request DELETE /builds/rome/2 + AND user makes request DELETE /logs/rome/1 + AND user makes request DELETE /logs/rome/2 + + WHEN user makes request GET /projects + THEN body matches {"projects":[]} + + WHEN user makes request GET /pipelines + THEN body matches {"pipelines":[]} + + WHEN user makes request GET /builds + THEN body matches {"builds":[]} + + WHEN user makes request GET /logs + THEN body matches {"log":[]} + FINALLY stop ick controller @@ -841,20 +868,23 @@ This scenario tests the controller API to simulate a build. 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 artifact store - AND controller config uses https://auth.example.com as authentication - AND controller config uses https://notify.example.com as notify - AND an access token for user with scopes + GIVEN an access token for user with scopes + ... uapi_pipelines_get ... uapi_pipelines_post + ... uapi_pipelines_id_delete + ... uapi_projects_get ... uapi_projects_post + ... uapi_projects_id_delete ... uapi_projects_id_status_put ... uapi_projects_id_status_get ... uapi_projects_id_builds_get ... uapi_workers_id_get + ... uapi_workers_id_delete ... uapi_builds_get + ... uapi_builds_id_delete ... uapi_builds_id_get + ... uapi_logs_get + ... uapi_logs_id_delete ... uapi_logs_id_get AND a running ick controller @@ -891,6 +921,7 @@ Register a worker. ... { ... } THEN result has status code 201 + AND worker id is OBELIX Build the first project. @@ -909,7 +940,7 @@ Build the first project. ... "build_id": "first/1", ... "action_id": "1", ... "build_number": 1, - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "first", ... "exit_code": 0, ... "stdout": "", @@ -930,7 +961,7 @@ Build the first project. ... "build_id": "first/1", ... "action_id": "2", ... "build_number": 1, - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "first", ... "exit_code": 0, ... "stdout": "", @@ -950,7 +981,7 @@ Build the first project. ... "build_id": "first/1", ... "action_id": "3", ... "build_number": 1, - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "first", ... "exit_code": 0, ... "stdout": "", @@ -981,7 +1012,7 @@ Build second project. ... { ... "build_id": "second/1", ... "action_id": "1", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "second", ... "exit_code": 0, ... "stdout": "", @@ -1001,7 +1032,7 @@ Build second project. ... { ... "build_id": "second/1", ... "action_id": "2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "second", ... "exit_code": 0, ... "stdout": "", @@ -1021,7 +1052,7 @@ Build second project. ... "build_id": "second/1", ... "action_id": "3", ... "build_number": 1, - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "second", ... "exit_code": 0, ... "stdout": "", @@ -1038,8 +1069,29 @@ Build second project. Finish up. - FINALLY stop ick controller + WHEN user makes request DELETE /projects/first + AND user makes request DELETE /projects/second + AND user makes request DELETE /pipelines/do_something + AND user makes request DELETE /workers/${OBELIX} + AND user makes request DELETE /builds/first/1 + AND user makes request DELETE /builds/second/1 + AND user makes request DELETE /logs/first/1 + AND user makes request DELETE /logs/second/1 + + WHEN user makes request GET /projects + THEN body matches {"projects":[]} + + WHEN user makes request GET /pipelines + THEN body matches {"pipelines":[]} + + WHEN user makes request GET /builds + THEN body matches {"builds":[]} + + WHEN user makes request GET /logs + THEN body matches {"log":[]} + + FINALLY stop ick controller # Build two projects concurrently @@ -1049,20 +1101,23 @@ This scenario tests the controller API to simulate a build. 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 artifact store - AND controller config uses https://auth.example.com as authentication - AND controller config uses https://notify.example.com as notify - AND an access token for user with scopes + GIVEN an access token for user with scopes + ... uapi_pipelines_get ... uapi_pipelines_post + ... uapi_pipelines_id_delete + ... uapi_projects_get ... uapi_projects_post + ... uapi_projects_id_delete ... uapi_projects_id_status_put ... uapi_projects_id_status_get ... uapi_projects_id_builds_get ... uapi_workers_id_get + ... uapi_workers_id_delete ... uapi_builds_get + ... uapi_builds_id_delete ... uapi_builds_id_get + ... uapi_logs_get + ... uapi_logs_id_delete ... uapi_logs_id_get AND a running ick controller @@ -1101,6 +1156,7 @@ Register a couple of workers. ... { ... } THEN result has status code 201 + AND worker id is ASTERIX GIVEN an access token for obelix with scopes ... uapi_workers_post @@ -1110,6 +1166,7 @@ Register a couple of workers. ... { ... } THEN result has status code 201 + AND worker id is OBELIX Trigger both projects. @@ -1147,7 +1204,7 @@ Trigger both projects. ... "build_id": "first/1", ... "action_id": "1", ... "build_number": 1, - ... "worker": "asterix", + ... "worker": "${ASTERIX}", ... "project": "first", ... "exit_code": 0, ... "stdout": "", @@ -1175,7 +1232,7 @@ Trigger both projects. ... "build_id": "second/1", ... "action_id": "1", ... "build_number": 1, - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "second", ... "exit_code": 0, ... "stdout": "", @@ -1195,7 +1252,7 @@ Trigger both projects. ... { ... "build_id": "first/1", ... "action_id": "2", - ... "worker": "asterix", + ... "worker": "${ASTERIX}", ... "project": "first", ... "exit_code": 0, ... "stdout": "", @@ -1214,7 +1271,7 @@ Trigger both projects. ... { ... "build_id": "first/1", ... "action_id": "3", - ... "worker": "asterix", + ... "worker": "${ASTERIX}", ... "project": "first", ... "exit_code": 0, ... "stdout": "", @@ -1230,7 +1287,7 @@ Trigger both projects. ... { ... "build_id": "second/1", ... "action_id": "2", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "second", ... "exit_code": 0, ... "stdout": "", @@ -1249,7 +1306,7 @@ Trigger both projects. ... { ... "build_id": "second/1", ... "action_id": "3", - ... "worker": "obelix", + ... "worker": "${OBELIX}", ... "project": "second", ... "exit_code": 0, ... "stdout": "", @@ -1264,6 +1321,28 @@ Trigger both projects. WHEN user requests list of builds THEN the list of builds is ["first/1", "second/1"] -Finish up. +Finish up. Delete the resource we created. + + WHEN user makes request DELETE /projects/first + AND user makes request DELETE /projects/second + AND user makes request DELETE /pipelines/do_something + AND user makes request DELETE /workers/${ASTERIX} + AND user makes request DELETE /workers/${OBELIX} + AND user makes request DELETE /builds/first/1 + AND user makes request DELETE /builds/second/1 + AND user makes request DELETE /logs/first/1 + AND user makes request DELETE /logs/second/1 + + WHEN user makes request GET /projects + THEN body matches {"projects":[]} + + WHEN user makes request GET /pipelines + THEN body matches {"pipelines":[]} + + WHEN user makes request GET /builds + THEN body matches {"builds":[]} + + WHEN user makes request GET /logs + THEN body matches {"log":[]} FINALLY stop ick controller |