Merge branch '11139-nodemanager-mem-scale-factor'
[arvados.git] / services / nodemanager / tests / test_failure.py
index f30ea15498a8112fff8f612c427aff0719aa541b..285aa03c7deaa84a07ab6407151f77f5f2b08a31 100644 (file)
@@ -24,9 +24,12 @@ class BogusActor(arvnodeman.baseactor.BaseNodeManagerActor):
         raise self.exp
 
     def ping(self):
+        # Called by WatchdogActorTest, this delay is longer than the test timeout
+        # of 1 second, which should cause the watchdog ping to fail.
         time.sleep(2)
+        return True
 
-class ActorUnhandledExceptionTest(unittest.TestCase):
+class ActorUnhandledExceptionTest(testutil.ActorTestMixin, unittest.TestCase):
     def test_fatal_error(self):
         for e in (MemoryError(), threading.ThreadError(), OSError(errno.ENOMEM, "")):
             with mock.patch('os.kill') as kill_mock:
@@ -42,11 +45,11 @@ class ActorUnhandledExceptionTest(unittest.TestCase):
         act.actor_ref.stop(block=True)
         self.assertFalse(kill_mock.called)
 
-class WatchdogActorTest(unittest.TestCase):
+class WatchdogActorTest(testutil.ActorTestMixin, unittest.TestCase):
     @mock.patch('os.kill')
     def test_time_timout(self, kill_mock):
         act = BogusActor.start(OSError(errno.ENOENT, ""))
-        watch = arvnodeman.baseactor.WatchdogActor.start(1)
+        watch = arvnodeman.baseactor.WatchdogActor.start(1, act)
         watch.stop(block=True)
         act.stop(block=True)
         self.assertTrue(kill_mock.called)