Merge branch 'master' into 11071-fts-perf-test
[arvados.git] / services / nodemanager / tests / test_failure.py
index f543f645f6d765a0d36025f30438d62b03f45d9d..285aa03c7deaa84a07ab6407151f77f5f2b08a31 100644 (file)
@@ -29,27 +29,27 @@ class BogusActor(arvnodeman.baseactor.BaseNodeManagerActor):
         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.killpg') as killpg_mock:
+            with mock.patch('os.kill') as kill_mock:
                 act = BogusActor.start(e).tell_proxy()
                 act.doStuff()
                 act.actor_ref.stop(block=True)
-                self.assertTrue(killpg_mock.called)
+                self.assertTrue(kill_mock.called)
 
-    @mock.patch('os.killpg')
-    def test_nonfatal_error(self, killpg_mock):
+    @mock.patch('os.kill')
+    def test_nonfatal_error(self, kill_mock):
         act = BogusActor.start(OSError(errno.ENOENT, "")).tell_proxy()
         act.doStuff()
         act.actor_ref.stop(block=True)
-        self.assertFalse(killpg_mock.called)
+        self.assertFalse(kill_mock.called)
 
-class WatchdogActorTest(unittest.TestCase):
-    @mock.patch('os.killpg')
-    def test_time_timout(self, killpg_mock):
+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, act)
         watch.stop(block=True)
         act.stop(block=True)
-        self.assertTrue(killpg_mock.called)
+        self.assertTrue(kill_mock.called)