[Neo-report] r1974 gregory - in /trunk/neo: master/ tests/functional/ tests/master/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 26 17:21:00 CET 2010


Author: gregory
Date: Fri Mar 26 17:20:59 2010
New Revision: 1974

Log:
Bug fix: Broadcast only to running nodes (test added).

Modified:
    trunk/neo/master/app.py
    trunk/neo/tests/functional/testStorage.py
    trunk/neo/tests/master/testMasterApp.py

Modified: trunk/neo/master/app.py
==============================================================================
--- trunk/neo/master/app.py [iso-8859-1] (original)
+++ trunk/neo/master/app.py [iso-8859-1] Fri Mar 26 17:20:59 2010
@@ -266,7 +266,7 @@
         # send at most one non-empty notification packet per node
         for node in self.nm.getIdentifiedList():
             node_list = node_dict.get(node.getType(), [])
-            if node_list:
+            if node_list and node.isRunning():
                 node.notify(Packets.NotifyNodeInformation(node_list))
 
     def broadcastPartitionChanges(self, cell_list):
@@ -277,6 +277,8 @@
         ptid = self.pt.setNextID()
         self.pt.log()
         for node in self.nm.getIdentifiedList():
+            if not node.isRunning():
+                continue
             if node.isClient() or node.isStorage() or node.isAdmin():
                 node.notify(Packets.NotifyPartitionChanges(ptid, cell_list))
 

Modified: trunk/neo/tests/functional/testStorage.py
==============================================================================
--- trunk/neo/tests/functional/testStorage.py [iso-8859-1] (original)
+++ trunk/neo/tests/functional/testStorage.py [iso-8859-1] Fri Mar 26 17:20:59 2010
@@ -451,6 +451,22 @@
         self.assertEqual(len(self.neo.getStorageList()), 1)
         self.neo.expectOudatedCells(number=0)
 
+    def testDropNodeWithOtherPending(self):
+        """ Ensure we can drop a node """
+        # start with one storage
+        (started, stopped) = self.__setup(storage_number=2, replicas=1,
+                pending_number=1, partitions=10)
+        self.__expectRunning(started[0])
+        self.__expectNotKnown(stopped[0])
+        self.neo.expectOudatedCells(number=0)
+        self.neo.expectClusterRunning()
+
+        # set the second storage in pending state and drop the first
+        stopped[0].start()
+        self.__expectPending(stopped[0])
+        self.neo.neoctl.dropNode(started[0].getUUID())
+        self.__expectNotKnown(started[0])
+        self.__expectPending(stopped[0])
 
 if __name__ == "__main__":
     unittest.main()

Modified: trunk/neo/tests/master/testMasterApp.py
==============================================================================
--- trunk/neo/tests/master/testMasterApp.py [iso-8859-1] (original)
+++ trunk/neo/tests/master/testMasterApp.py [iso-8859-1] Fri Mar 26 17:20:59 2010
@@ -62,6 +62,9 @@
         master.setConnection(master_conn)
         storage.setConnection(storage_conn)
         client.setConnection(client_conn)
+        master.setRunning()
+        client.setRunning()
+        storage.setRunning()
         self.app.nm.add(storage)
         self.app.nm.add(client)
 
@@ -96,6 +99,15 @@
         self.checkNoPacketSent(master_conn)
         self.checkNotifyNodeInformation(storage_conn)
 
+        # node not running, don't send informations
+        client.setPending()
+
+        self.app.broadcastNodesInformation([s_node])
+        # check conn
+        self.checkNotifyNodeInformation(client_conn)
+        self.checkNoPacketSent(master_conn)
+        self.checkNotifyNodeInformation(storage_conn)
+
 
 if __name__ == '__main__':
     unittest.main()





More information about the Neo-report mailing list