From c0f473f116e091667ad15971f416f9b6a98706f2 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Wed, 27 Apr 2016 18:05:45 +0200 Subject: [PATCH] [backend] Simulate job killing by worker on tests --- beat/web/backend/tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/beat/web/backend/tests.py b/beat/web/backend/tests.py index 014cbff0e..ecfdb0da1 100644 --- a/beat/web/backend/tests.py +++ b/beat/web/backend/tests.py @@ -1179,6 +1179,11 @@ class Scheduling(BaseBackendTestCase): xp.cancel() + # simulate worker cancelling + split.refresh_from_db() + self.assertEqual(split.status, Job.KILL) + split.end(None, Job.CANCELLED) + self.assertEqual( [str(k) for k in xp.blocks.order_by('id').values_list('status', flat=True)], [Block.CANCELLED, Block.CANCELLED] @@ -1630,6 +1635,12 @@ class Scheduling(BaseBackendTestCase): # cancels the blocking experiment - the blocked one must continue xp.cancel() + + # simulate worker cancelling + split.refresh_from_db() + self.assertEqual(split.status, Job.KILL) + split.end(None, Job.CANCELLED) + self.assertEqual( [str(k) for k in xp.blocks.order_by('id').values_list('status', flat=True)], [Block.CANCELLED, Block.CANCELLED] -- GitLab