From f0ccb8150a67b10e11b3358d6385e31619e6d1e3 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 26 Nov 2017 15:01:53 +0100 Subject: Update: yarn scenarios to use named pipelines --- yarns/100-projects.yarn | 105 ++++++++++------------------------------------ yarns/400-build.yarn | 31 ++++++-------- yarns/500-build-fail.yarn | 22 +++++----- 3 files changed, 48 insertions(+), 110 deletions(-) (limited to 'yarns') diff --git a/yarns/100-projects.yarn b/yarns/100-projects.yarn index aa04b7a..ba723d3 100644 --- a/yarns/100-projects.yarn +++ b/yarns/100-projects.yarn @@ -27,24 +27,9 @@ like this: { "project": "ick2-website", "pipelines": [ - { - "name": "setup-workspace", - "actions": [ - { "shell": "git clone git://git.liw.fi/ick2-website src" } - ] - }, - { - "name": "build-website", - "actions": [ - { "shell": "cd src && ikiwiki --setup ikiwiki.setup" } - ] - }, - { - "name": "publish-website", - "actions": [ - { "shell": "cd html && rsync -a --delete . server::/srv/http/ick2/." } - ] - } + "setup-workspace", + "build-website", + "publish-website" ] } @@ -63,6 +48,7 @@ building them. We start by starting an instance of the controller. SCENARIO managing projects GIVEN an RSA key pair for token signing AND an access token for user with scopes + ... uapi_pipelines_post ... uapi_projects_get ... uapi_projects_post ... uapi_projects_id_get @@ -75,34 +61,25 @@ building them. We start by starting an instance of the controller. THEN result has status code 200 AND body matches { "projects": [] } + WHEN user makes request POST /pipelines with a valid token and body + ... { + ... "name": "build", + ... "actions": [ + ... { "shell": "git clone git://repo src" }, + ... { "shell": "mkdir html" }, + ... { "shell": "ikiwiki src html" } + ... ] + ... } WHEN user makes request POST /projects with a valid token and body ... { ... "project": "website", - ... "pipelines": [ - ... { - ... "name": "build", - ... "actions": [ - ... { "shell": "git clone git://repo src" }, - ... { "shell": "mkdir html" }, - ... { "shell": "ikiwiki src html" } - ... ] - ... } - ... ] + ... "pipelines": ["build"] ... } THEN result has status code 201 AND body matches ... { ... "project": "website", - ... "pipelines": [ - ... { - ... "name": "build", - ... "actions": [ - ... { "shell": "git clone git://repo src" }, - ... { "shell": "mkdir html" }, - ... { "shell": "ikiwiki src html" } - ... ] - ... } - ... ] + ... "pipelines": ["build"] ... } AND controller state directory contains project website @@ -122,16 +99,7 @@ Creating a new project with the same name is forbidden. ... "projects": [ ... { ... "project": "website", - ... "pipelines": [ - ... { - ... "name": "build", - ... "actions": [ - ... { "shell": "git clone git://repo src" }, - ... { "shell": "mkdir html" }, - ... { "shell": "ikiwiki src html" } - ... ] - ... } - ... ] + ... "pipelines": ["build"] ... } ... ] ... } @@ -143,43 +111,22 @@ Creating a new project with the same name is forbidden. AND body matches ... { ... "project": "website", - ... "pipelines": [ - ... { - ... "name": "build", - ... "actions": [ - ... { "shell": "git clone git://repo src" }, - ... { "shell": "mkdir html" }, - ... { "shell": "ikiwiki src html" } - ... ] - ... } - ... ] + ... "pipelines": ["build"] ... } WHEN user makes request PUT /projects/website with a valid token ... and body ... { ... "project": "website", - ... "pipelines": [ - ... { - ... "name": "build", - ... "actions": [ - ... { "shell": "build-it" } - ... ] - ... } - ... ] + ... "parameters": {"foo": "bar"}, + ... "pipelines": ["build"] ... } THEN result has status code 200 AND body matches ... { ... "project": "website", - ... "pipelines": [ - ... { - ... "name": "build", - ... "actions": [ - ... { "shell": "build-it" } - ... ] - ... } - ... ] + ... "parameters": {"foo": "bar"}, + ... "pipelines": ["build"] ... } AND controller state directory contains project website @@ -188,14 +135,8 @@ Creating a new project with the same name is forbidden. AND body matches ... { ... "project": "website", - ... "pipelines": [ - ... { - ... "name": "build", - ... "actions": [ - ... { "shell": "build-it" } - ... ] - ... } - ... ] + ... "parameters": {"foo": "bar"}, + ... "pipelines": ["build"] ... } WHEN user makes request DELETE /projects/website diff --git a/yarns/400-build.yarn b/yarns/400-build.yarn index a07eda4..ec3e8e5 100644 --- a/yarns/400-build.yarn +++ b/yarns/400-build.yarn @@ -28,6 +28,7 @@ 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 @@ -38,23 +39,24 @@ Set up the controller. ... uapi_logs_id_get AND a running ick controller -Add up a project. +Add up a project with some named pipelines. + WHEN user makes request POST /pipelines with a valid token and body + ... { + ... "name": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ] + ... } + THEN result has status code 201 WHEN user makes request POST /projects with a valid token and body ... { ... "project": "rome", ... "parameters": { ... "foo": "bar" ... }, - ... "pipelines": [ - ... { - ... "name": "construct", - ... "actions": [ - ... { "shell": "day 1" }, - ... { "shell": "day 2" } - ... ] - ... } - ... ] + ... "pipelines": ["construct"] ... } THEN result has status code 201 @@ -66,14 +68,7 @@ Add a second project so we know each project gets its own work steps. ... "parameters": { ... "hey": "there" ... }, - ... "pipelines": [ - ... { - ... "name": "construct", - ... "actions": [ - ... { "shell": "fork" } - ... ] - ... } - ... ] + ... "pipelines": ["construct"] ... } THEN result has status code 201 diff --git a/yarns/500-build-fail.yarn b/yarns/500-build-fail.yarn index 2f5d79c..f0afa32 100644 --- a/yarns/500-build-fail.yarn +++ b/yarns/500-build-fail.yarn @@ -29,6 +29,7 @@ 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 @@ -39,20 +40,21 @@ Set up the controller. ... uapi_logs_id_get AND a running ick controller -Add up a project. +Add up a project and its pipelines. + WHEN user makes request POST /pipelines with a valid token and body + ... { + ... "name": "construct", + ... "actions": [ + ... { "shell": "day 1" }, + ... { "shell": "day 2" } + ... ] + ... } + THEN result has status code 201 WHEN user makes request POST /projects with a valid token and body ... { ... "project": "rome", - ... "pipelines": [ - ... { - ... "name": "construct", - ... "actions": [ - ... { "shell": "day 1" }, - ... { "shell": "day 2" } - ... ] - ... } - ... ] + ... "pipelines": ["construct"] ... } THEN result has status code 201 -- cgit v1.2.1