[ARVADOS] updated: 05e27a52779f8c14942cb533398fa81cbf111edb

Git user git at public.curoverse.com
Mon Feb 29 10:33:29 EST 2016


Summary of changes:
 services/nodemanager/tests/test_failure.py | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

       via  05e27a52779f8c14942cb533398fa81cbf111edb (commit)
      from  0a1c109684c62f0bc42e7dca30319fc8222dbef7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 05e27a52779f8c14942cb533398fa81cbf111edb
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Feb 29 10:33:27 2016 -0500

    8437: Test all exceptions that should be caught.

diff --git a/services/nodemanager/tests/test_failure.py b/services/nodemanager/tests/test_failure.py
index b7127fc..afebb9c 100644
--- a/services/nodemanager/tests/test_failure.py
+++ b/services/nodemanager/tests/test_failure.py
@@ -2,7 +2,9 @@
 
 from __future__ import absolute_import, print_function
 
+import errno
 import logging
+import threading
 import unittest
 
 import mock
@@ -13,13 +15,29 @@ from . import testutil
 import arvnodeman.fullstopactor
 
 class BogusActor(arvnodeman.fullstopactor.FullStopActor):
+    def __init__(self, e):
+        super(BogusActor, self).__init__()
+        self.exp = e
+
     def doStuff(self):
-        raise MemoryError
+        raise self.exp
 
 class ActorUnhandledExceptionTest(unittest.TestCase):
     def test1(self):
+        for e in (MemoryError(), threading.ThreadError(), OSError(errno.ENOMEM, "")):
+            with mock.patch('os.killpg') as killpg_mock:
+                act = BogusActor.start(e)
+                act.tell({
+                    'command': 'pykka_call',
+                    'attr_path': ("doStuff",),
+                    'args': [],
+                    'kwargs': {}
+                })
+                act.stop(block=True)
+                self.assertTrue(killpg_mock.called)
+
         with mock.patch('os.killpg') as killpg_mock:
-            act = BogusActor.start()
+            act = BogusActor.start(OSError(errno.ENOENT, ""))
             act.tell({
                 'command': 'pykka_call',
                 'attr_path': ("doStuff",),
@@ -27,4 +45,4 @@ class ActorUnhandledExceptionTest(unittest.TestCase):
                 'kwargs': {}
             })
             act.stop(block=True)
-            self.assertTrue(killpg_mock.called)
+            self.assertFalse(killpg_mock.called)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list