8437: Add missing test.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 26 Feb 2016 16:38:50 +0000 (11:38 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 26 Feb 2016 16:38:50 +0000 (11:38 -0500)
services/nodemanager/tests/test_failure.py [new file with mode: 0644]

diff --git a/services/nodemanager/tests/test_failure.py b/services/nodemanager/tests/test_failure.py
new file mode 100644 (file)
index 0000000..b7127fc
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+from __future__ import absolute_import, print_function
+
+import logging
+import unittest
+
+import mock
+import pykka
+
+from . import testutil
+
+import arvnodeman.fullstopactor
+
+class BogusActor(arvnodeman.fullstopactor.FullStopActor):
+    def doStuff(self):
+        raise MemoryError
+
+class ActorUnhandledExceptionTest(unittest.TestCase):
+    def test1(self):
+        with mock.patch('os.killpg') as killpg_mock:
+            act = BogusActor.start()
+            act.tell({
+                'command': 'pykka_call',
+                'attr_path': ("doStuff",),
+                'args': [],
+                'kwargs': {}
+            })
+            act.stop(block=True)
+            self.assertTrue(killpg_mock.called)