summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-26 15:01:53 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-26 17:59:00 +0100
commitf0ccb8150a67b10e11b3358d6385e31619e6d1e3 (patch)
tree8c03eff4e48cbf7ceb290c5362d4b9ace201e908 /yarns
parent4382c0943c5e84477fcdf6f1d26397c8a60a4624 (diff)
downloadick2-f0ccb8150a67b10e11b3358d6385e31619e6d1e3.tar.gz
Update: yarn scenarios to use named pipelines
Diffstat (limited to 'yarns')
-rw-r--r--yarns/100-projects.yarn105
-rw-r--r--yarns/400-build.yarn31
-rw-r--r--yarns/500-build-fail.yarn22
3 files changed, 48 insertions, 110 deletions
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