summaryrefslogtreecommitdiff
path: root/yarns.webapp/040-running-jobs.yarn
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-10-23 09:49:37 +0100
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-10-23 09:49:37 +0100
commitd7ca3f2f14ad28437f7332ca387a790fecb8b081 (patch)
tree90d364dc107b0c032ecc5befc4f36393d9b655b0 /yarns.webapp/040-running-jobs.yarn
parentf9ea6b7761a5dbfe7b5e5b2adcabf70525184d7e (diff)
parentd91b652951cf9203c8e8cd255a0e0a81af6d2591 (diff)
downloadlorry-controller-d7ca3f2f14ad28437f7332ca387a790fecb8b081.tar.gz
Merge branch 'baserock/pedroalvarez/old-jobs-removal'
Reviewed-by: Richard Maw Reviewed-by: Pedro Alvarez
Diffstat (limited to 'yarns.webapp/040-running-jobs.yarn')
-rw-r--r--yarns.webapp/040-running-jobs.yarn56
1 files changed, 56 insertions, 0 deletions
diff --git a/yarns.webapp/040-running-jobs.yarn b/yarns.webapp/040-running-jobs.yarn
index 571afd6..cbc8f75 100644
--- a/yarns.webapp/040-running-jobs.yarn
+++ b/yarns.webapp/040-running-jobs.yarn
@@ -359,3 +359,59 @@ Remove it.
Cleanup.
FINALLY WEBAPP terminates
+
+
+Remove old terminated jobs with helper program
+--------------------------
+
+There is a helper program to remove old jobs automatically.
+
+ SCENARIO remove old terminated jobs
+
+Setup.
+
+ GIVEN a new git repository in CONFGIT
+ AND an empty lorry-controller.conf in CONFGIT
+ AND lorry-controller.conf in CONFGIT adds lorries *.lorry using prefix upstream
+ AND WEBAPP uses CONFGIT as its configuration directory
+ AND a running WEBAPP
+ GIVEN Lorry file CONFGIT/foo.lorry with {"foo":{"type":"git","url":"git://foo"}}
+ WHEN admin makes request POST /1.0/read-configuration
+
+Start job 1. We start it a known time of 100, so that we can control
+when jobs become old.
+
+ WHEN admin makes request POST /1.0/pretend-time with now=100
+ AND admin makes request POST /1.0/give-me-job with host=testhost&pid=123
+ THEN response has job_id set to 1
+
+Remove old jobs while job 1 is running, still pretending time is 100
+seconds since epoch. This should leave job 1 running.
+
+ WHEN admin removes old jobs at 100
+ AND admin makes request GET /1.0/list-jobs
+ THEN response has job_ids set to [1]
+
+Finish the job.
+
+ WHEN MINION makes request POST /1.0/job-update with job_id=1&exit=0
+ WHEN admin makes request GET /1.0/list-jobs
+ THEN response has job_ids set to [1]
+
+Remove old jobs, still at 100 seconds. Job 1 should still remain, as
+it just finished.
+
+ WHEN admin removes old jobs at 100
+ AND admin makes request GET /1.0/list-jobs
+ THEN response has job_ids set to [1]
+
+Let a long time pass, and remove old jobs again. Job 1 should now go
+away.
+
+ WHEN admin removes old jobs at 100000000000
+ AND admin makes request GET /1.0/list-jobs
+ THEN response has job_ids set to []
+
+Cleanup.
+
+ FINALLY WEBAPP terminates