diff options
Diffstat (limited to 'yarns.webapp/040-running-jobs.yarn')
-rw-r--r-- | yarns.webapp/040-running-jobs.yarn | 56 |
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 |