File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,11 @@ def delete_old(self):
5353 """
5454 Delete all jobs older than DELETE_JOBS_AFTER_HOURS
5555 """
56- delete_jobs_in_states = [Job .STATES .FAILED , Job .STATES .COMPLETE ]
56+ delete_jobs_in_states = [
57+ Job .STATES .FAILED ,
58+ Job .STATES .COMPLETE ,
59+ Job .STATES .STOPPING ,
60+ ]
5761 delete_jobs_created_before = timezone .now () - datetime .timedelta (
5862 hours = DELETE_JOBS_AFTER_HOURS
5963 )
Original file line number Diff line number Diff line change @@ -325,14 +325,18 @@ def test_delete_old_jobs(self):
325325 j2 .created = two_days_ago
326326 j2 .save ()
327327
328- j3 = Job .objects .create (name = "testjob" , state = Job .STATES .NEW )
328+ j3 = Job .objects .create (name = "testjob" , state = Job .STATES .STOPPING )
329329 j3 .created = two_days_ago
330330 j3 .save ()
331331
332- j4 = Job .objects .create (name = "testjob" , state = Job .STATES .COMPLETE )
332+ j4 = Job .objects .create (name = "testjob" , state = Job .STATES .NEW )
333+ j4 .created = two_days_ago
334+ j4 .save ()
335+
336+ j5 = Job .objects .create (name = "testjob" , state = Job .STATES .COMPLETE )
333337
334338 Job .objects .delete_old ()
335339
336340 self .assertEqual (Job .objects .count (), 2 )
337- self .assertTrue (j3 in Job .objects .all ())
338341 self .assertTrue (j4 in Job .objects .all ())
342+ self .assertTrue (j5 in Job .objects .all ())
You can’t perform that action at this time.
0 commit comments