[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/tests/ Use wait_until to avoid spurious test failures on challenged machines.

Jim Fulton jim at zope.com
Thu Jul 15 15:52:13 EDT 2010


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



More information about the Zodb-checkins mailing list