[Zope3-checkins] CVS: Zope3/src/zodb/zeo/tests - connection.py:1.2.4.1 forker.py:1.2.4.1

Jeremy Hylton jeremy@zope.com
Thu, 23 Jan 2003 13:06:31 -0500


Update of /cvs-repository/Zope3/src/zodb/zeo/tests
In directory cvs.zope.org:/tmp/cvs-serv22502/zeo/tests

Modified Files:
      Tag: new-pickle-branch
	connection.py forker.py 
Log Message:
Make the number of retries on the adminaddr configurable.
Set retries to 10 for reconnect tests since they seem to take a long time.


=== Zope3/src/zodb/zeo/tests/connection.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zodb/zeo/tests/connection.py:1.2	Wed Dec 25 09:12:22 2002
+++ Zope3/src/zodb/zeo/tests/connection.py	Thu Jan 23 13:06:28 2003
@@ -117,6 +117,11 @@
         storage.registerDB(DummyDB())
         return storage
 
+    # The start_zeo_server() function attempts to connect to the new
+    # server process once a second.  After forker_admin_retries attempts,
+    # it fails with an error.
+    forker_admin_retries = 5
+
     def startServer(self, create=True, index=0,
                     read_only=False, ro_svr=False, keep=False):
         addr = self.addr[index]
@@ -125,7 +130,7 @@
         path = "%s.%d" % (self.file, index)
         conf = self.getConfig(path, create, read_only)
         zeoport, adminaddr, pid = forker.start_zeo_server(
-            conf, addr, ro_svr, keep)
+            conf, addr, ro_svr, keep, self.forker_admin_retries)
         self._pids.append(pid)
         self._servers.append(adminaddr)
 
@@ -421,6 +426,7 @@
 
 class ReconnectionTests(CommonSetupTearDown):
     keep = True
+    forker_admin_retries = 10
 
     def checkReadOnlyStorage(self):
         # Open a read-only client to a read-only *storage*; stores fail


=== Zope3/src/zodb/zeo/tests/forker.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zodb/zeo/tests/forker.py:1.2	Wed Dec 25 09:12:22 2002
+++ Zope3/src/zodb/zeo/tests/forker.py	Thu Jan 23 13:06:28 2003
@@ -51,7 +51,8 @@
     raise RuntimeError, "Can't find port"
 
 
-def start_zeo_server(conf, addr=None, ro_svr=False, keep=False):
+def start_zeo_server(conf, addr=None, ro_svr=False, keep=False,
+                     admin_retries=5):
     """Start a ZEO server in a separate process.
 
     Returns the ZEO port, the test server port, and the pid.
@@ -83,7 +84,7 @@
     adminaddr = ('localhost', port+1)
     # We need to wait until the server starts, but not forever
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-    for i in range(5):
+    for i in range(admin_retries):
         try:
             logging.debug('forker: connect %s', i)
             s.connect(adminaddr)