[Neo-report] r2086 gregory - in /trunk/neo: bootstrap.py tests/testBootstrap.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri May 7 16:49:18 CEST 2010


Author: gregory
Date: Fri May  7 16:49:17 2010
New Revision: 2086

Log:
Update master node state during bootstrap.

Allow know the primary master as RUNNING state instead of UNKNOWN.

Modified:
    trunk/neo/bootstrap.py
    trunk/neo/tests/testBootstrap.py

Modified: trunk/neo/bootstrap.py
==============================================================================
--- trunk/neo/bootstrap.py [iso-8859-1] (original)
+++ trunk/neo/bootstrap.py [iso-8859-1] Fri May  7 16:49:17 2010
@@ -52,6 +52,7 @@
         Now ask who's the primary.
         """
         EventHandler.connectionCompleted(self, conn)
+        self.current.setRunning()
         conn.ask(Packets.AskPrimary())
 
     def connectionFailed(self, conn):
@@ -67,6 +68,7 @@
         Triggered when an established network connection is lost.
         Restart bootstrap.
         """
+        self.current.setTemporarilyDown()
         self.current = None
 
     def notReady(self, conn, message):

Modified: trunk/neo/tests/testBootstrap.py
==============================================================================
--- trunk/neo/tests/testBootstrap.py [iso-8859-1] (original)
+++ trunk/neo/tests/testBootstrap.py [iso-8859-1] Fri May  7 16:49:17 2010
@@ -45,13 +45,17 @@
 
     # Tests
     def testConnectionCompleted(self):
-        conn = self.getFakeConnection(address=("127.0.0.1", self.master_port))
+        address=("127.0.0.1", self.master_port)
+        conn = self.getFakeConnection(address=address)
+        self.bootstrap.current = self.app.nm.createMaster(address=address)
         self.bootstrap.connectionCompleted(conn)
         self.checkAskPrimary(conn)
 
     def testHandleNotReady(self):
         # the primary is not ready
-        conn = self.getFakeConnection()
+        address=("127.0.0.1", self.master_port)
+        conn = self.getFakeConnection(address=address)
+        self.bootstrap.current = self.app.nm.createMaster(address=address)
         self.bootstrap.notReady(conn, '')
         self.checkClosed(conn)
         self.checkNoPacketSent(conn)





More information about the Neo-report mailing list