BIND 10 trac2353, updated. 494bbca16cea584ba6ad5d2c5f9a273d809f902d [2353] Ensure that get_processes() returns a sorted list

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Nov 9 06:02:14 UTC 2012


The branch, trac2353 has been updated
       via  494bbca16cea584ba6ad5d2c5f9a273d809f902d (commit)
      from  67f4798a8a2457b8d284b75dcf1a6bcfeb8a0fa5 (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.

- Log -----------------------------------------------------------------
commit 494bbca16cea584ba6ad5d2c5f9a273d809f902d
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Nov 9 11:31:58 2012 +0530

    [2353] Ensure that get_processes() returns a sorted list

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

Summary of changes:
 src/bin/bind10/tests/bind10_test.py.in |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index cae56ca..4e3bd13 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -35,6 +35,7 @@ import isc
 import isc.log
 import isc.bind10.socket_cache
 import errno
+import random
 
 from isc.testutils.parse_args import TestOptParser, OptsError
 from isc.testutils.ccsession_mock import MockModuleCCSession
@@ -1410,14 +1411,28 @@ class TestBossComponents(unittest.TestCase):
         self.assertFalse(component in bob.components_to_restart)
 
     def test_get_processes(self):
-        '''Test that procsses are returned correctly.'''
+        '''Test that procsses are returned correctly, sorted by pid.'''
         bob = MockBob()
         bob.runnable = True
-        component = MockComponent('test', 53, 'Test')
-        bob.components[53] = component
+
+        pids = []
+        pids.extend(range(0, 20))
+        random.shuffle(pids)
+
+        for i in range(0, 20):
+            pid = pids[i]
+            component = MockComponent('test' + str(pid), pid, 'Test' + str(pid))
+            bob.components[pid] = component
 
         process_list = bob.get_processes()
-        self.assertEqual([[53, 'test', 'Test']], process_list)
+        self.assertEqual(20, len(process_list))
+
+        last_pid = -1
+        for process in process_list:
+            pid = process[0]
+            self.assertLessEqual(last_pid, pid)
+            last_pid = pid
+            self.assertEqual([pid, 'test' + str(pid), 'Test' + str(pid)], process)
 
     def test_reap_children(self):
         '''Test that children are queued to be restarted when they ask for it.'''



More information about the bind10-changes mailing list