[ARVADOS] updated: 469102b30008b4ee73c9f44b03a6bd82a2a91fb2

Git user git at public.curoverse.com
Thu Apr 21 14:03:06 EDT 2016


Summary of changes:
 .../tests/test_computenode_dispatch_slurm.py       | 25 +++++++++-------------
 services/nodemanager/tests/test_daemon.py          |  8 +------
 services/nodemanager/tests/testutil.py             |  7 ++++++
 3 files changed, 18 insertions(+), 22 deletions(-)

       via  469102b30008b4ee73c9f44b03a6bd82a2a91fb2 (commit)
      from  0cacef6ec2b553052e3897fee3067951f65117cd (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 469102b30008b4ee73c9f44b03a6bd82a2a91fb2
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Apr 21 14:02:54 2016 -0400

    Fix race conditions in test_node_undrained_when_shutdown_cancelled
    and test_boot_new_node_when_all_nodes_busy. refs #8953

diff --git a/services/nodemanager/tests/test_computenode_dispatch_slurm.py b/services/nodemanager/tests/test_computenode_dispatch_slurm.py
index 92858b6..85a40ce 100644
--- a/services/nodemanager/tests/test_computenode_dispatch_slurm.py
+++ b/services/nodemanager/tests/test_computenode_dispatch_slurm.py
@@ -55,30 +55,25 @@ class SLURMComputeNodeShutdownActorTestCase(ComputeNodeShutdownActorMixin,
 
     def test_slurm_bypassed_when_no_arvados_node(self, proc_mock):
         # Test we correctly handle a node that failed to bootstrap.
-        proc_mock.return_value = 'idle\n'
+        proc_mock.return_value = 'down\n'
         self.make_actor(start_time=0)
         self.check_success_flag(True)
         self.assertFalse(proc_mock.called)
 
     def test_node_undrained_when_shutdown_cancelled(self, proc_mock):
         try:
-            proc_mock.side_effect = iter(['drng\n', 'idle\n'])
+            proc_mock.side_effect = iter(['', 'drng\n', 'drng\n', ''])
             self.make_mocks(arvados_node=testutil.arvados_node_mock(job_uuid=True))
+            self.timer = testutil.MockTimer(False)
             self.make_actor()
-            self.shutdown_actor.cancel_shutdown("test")
+            self.busywait(lambda: proc_mock.call_args is not None)
+            self.shutdown_actor.cancel_shutdown("test").get(self.TIMEOUT)
             self.check_success_flag(False, 2)
-            self.check_slurm_got_args(proc_mock, 'NodeName=compute99', 'State=RESUME')
-        finally:
-            self.shutdown_actor.actor_ref.stop()
-
-    def test_alloc_node_undrained_when_shutdown_cancelled(self, proc_mock):
-        try:
-            proc_mock.side_effect = iter(['alloc\n'])
-            self.make_mocks(arvados_node=testutil.arvados_node_mock(job_uuid=True))
-            self.make_actor()
-            self.shutdown_actor.cancel_shutdown("test")
-            self.check_success_flag(False, 2)
-            self.check_slurm_got_args(proc_mock, 'sinfo', '--noheader', '-o', '%t', '-n', 'compute99')
+            self.assertEqual(proc_mock.call_args_list,
+                             [mock.call(['scontrol', 'update', 'NodeName=compute99', 'State=DRAIN', 'Reason=Node Manager shutdown']),
+                              mock.call(['sinfo', '--noheader', '-o', '%t', '-n', 'compute99']),
+                              mock.call(['sinfo', '--noheader', '-o', '%t', '-n', 'compute99']),
+                              mock.call(['scontrol', 'update', 'NodeName=compute99', 'State=RESUME'])])
         finally:
             self.shutdown_actor.actor_ref.stop()
 
diff --git a/services/nodemanager/tests/test_daemon.py b/services/nodemanager/tests/test_daemon.py
index 7da250b..d52cdae 100644
--- a/services/nodemanager/tests/test_daemon.py
+++ b/services/nodemanager/tests/test_daemon.py
@@ -233,6 +233,7 @@ class NodeManagerDaemonActorTestCase(testutil.ActorTestMixin,
         arv_node = testutil.arvados_node_mock(2, job_uuid=True)
         self.make_daemon([testutil.cloud_node_mock(2, size=size)], [arv_node],
                          [size], avail_sizes=[(size, {"cores":1})])
+        self.busywait(lambda: self.node_setup.start.called)
         self.stop_proxy(self.daemon)
         self.assertTrue(self.node_setup.start.called)
 
@@ -602,13 +603,6 @@ class NodeManagerDaemonActorTestCase(testutil.ActorTestMixin,
         self.stop_proxy(self.daemon)
         self.assertEqual(1, self.last_shutdown.stop.call_count)
 
-    def busywait(self, f):
-        n = 0
-        while not f() and n < 10:
-            time.sleep(.1)
-            n += 1
-        self.assertTrue(f())
-
     def test_node_create_two_sizes(self):
         small = testutil.MockSize(1)
         big = testutil.MockSize(2)
diff --git a/services/nodemanager/tests/testutil.py b/services/nodemanager/tests/testutil.py
index a17f088..1b6aab3 100644
--- a/services/nodemanager/tests/testutil.py
+++ b/services/nodemanager/tests/testutil.py
@@ -119,6 +119,13 @@ class ActorTestMixin(object):
             if result is not unassigned:
                 return result
 
+    def busywait(self, f):
+        n = 0
+        while not f() and n < 10:
+            time.sleep(.1)
+            n += 1
+        self.assertTrue(f())
+
 
 class DriverTestMixin(object):
     def setUp(self):

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list