SVN: ZODB/trunk/src/ZEO/tests/ Use wait_until to avoid spurious test failures on challenged machines.

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20100715195213.4BEE9941C9__43178.4730557867$1279223540$gmane$org@cvs.zope.org>
Log message for revision 114788:
  Use wait_until to avoid spurious test failures on challenged machines.
  

Changed:
  U   ZODB/trunk/src/ZEO/tests/invalidations_while_connecting.test
  U   ZODB/trunk/src/ZEO/tests/testConnection.py

-=-
Modified: ZODB/trunk/src/ZEO/tests/invalidations_while_connecting.test
===================================================================
--- ZODB/trunk/src/ZEO/tests/invalidations_while_connecting.test	2010-07-15 16:53:11 UTC (rev 114787)
+++ ZODB/trunk/src/ZEO/tests/invalidations_while_connecting.test	2010-07-15 19:52:12 UTC (rev 114788)
@@ -4,7 +4,7 @@
 As soon as a client registers with a server, it will recieve
 invalidations from the server.  The client must be careful to queue
 these invalidations until it is ready to deal with them.  At the time
-of the writing of this test, clients weren't careful enogh about
+of the writing of this test, clients weren't careful enough about
 queing invalidations.  This led to cache corruption in the form of
 both low-level file corruption as well as out-of-date records marked
 as current.
@@ -72,11 +72,13 @@
     ...    db = ZODB.DB(ZEO.ClientStorage.ClientStorage(addr, client='x'))
     ...    _ = lock.acquire()
     ...    try:
-    ...      time.sleep(.1)
-    ...      assert (db.storage.lastTransaction()
-    ...              == db.storage._server.lastTransaction()), (
-    ...                  db.storage.lastTransaction(),
-    ...                  db.storage._server.lastTransactiion())
+    ...      wait_until("connected and we've caught up",
+    ...                 lambda :
+    ...                    db.storage.is_connected()
+    ...                    and db.storage.lastTransaction()
+    ...                        == db.storage._server.lastTransaction()
+    ...                  )
+    ...
     ...      conn = db.open()
     ...      for i in range(1000):
     ...        if conn.root()[i].value != conn2.root()[i].value:

Modified: ZODB/trunk/src/ZEO/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testConnection.py	2010-07-15 16:53:11 UTC (rev 114787)
+++ ZODB/trunk/src/ZEO/tests/testConnection.py	2010-07-15 19:52:12 UTC (rev 114788)
@@ -135,7 +135,7 @@
         suite.addTest(sub)
     suite.addTest(doctest.DocFileSuite(
         'invalidations_while_connecting.test',
-        setUp=setupstack.setUpDirectory, tearDown=setupstack.tearDown,
+        setUp=ZEO.tests.forker.setUp, tearDown=setupstack.tearDown,
         ))
     suite.layer = ZODB.tests.util.MininalTestLayer('ZEO Connection Tests')
     return suite
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.