[Zope-Checkins] CVS: Zope/lib/python/ZEO/tests - testStart.py:1.17

Fred L. Drake, Jr. fred@zope.com
Mon, 10 Feb 2003 11:05:24 -0500


Update of /cvs-repository/Zope/lib/python/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv13897

Modified Files:
	testStart.py 
Log Message:
stop_server():  Wait for the pidfile to disappear; not really clean.
    Needed since we're not actually waiting for the ZEO server process
    to exit (it's a grandchild, not a child).  It we don't wait,
    there's a race condition between one test and the next -- if the
    ZEO server isn't done shutting down, the database may still be
    locked when the next test starts.


=== Zope/lib/python/ZEO/tests/testStart.py 1.16 => 1.17 ===
--- Zope/lib/python/ZEO/tests/testStart.py:1.16	Mon Jan 27 17:28:05 2003
+++ Zope/lib/python/ZEO/tests/testStart.py	Mon Feb 10 11:05:23 2003
@@ -72,6 +72,21 @@
 
     def stop_server(self):
         self.kill(pids=self.getpids())
+        # XXX Wait for the pidfile to disappear; not really clean.
+        # Needed since we're not actually waiting for the ZEO server
+        # process to exit (it's a grandchild, not a child).  It we
+        # don't wait, there's a race condition between one test and
+        # the next -- if the ZEO server isn't done shutting down, the
+        # database may still be locked when the next test starts.
+        i = 100
+        while 1:
+            if self.getpids():
+                break
+            time.sleep(0.1)
+            i -= 1
+        else:
+            print >>sys.stderr, "ZEO server pidfile did not disappear"
+            print >>sys.stderr, self.env.zeo_pid
 
     def kill(self, sig=signal.SIGTERM, pids=None):
         if pids is None: