[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/tests/ Updated a test to make it a little less prone to spurious failures.

Jim Fulton jim at zope.com
Thu May 13 15:06:45 EDT 2010


Log message for revision 112294:
  Updated a test to make it a little less prone to spurious failures.
  

Changed:
  U   ZODB/trunk/src/ZEO/tests/ConnectionTests.py
  U   ZODB/trunk/src/ZEO/tests/protocols.test

-=-
Modified: ZODB/trunk/src/ZEO/tests/ConnectionTests.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/ConnectionTests.py	2010-05-13 19:06:44 UTC (rev 112293)
+++ ZODB/trunk/src/ZEO/tests/ConnectionTests.py	2010-05-13 19:06:45 UTC (rev 112294)
@@ -592,7 +592,7 @@
     invq = 3
 
     def checkQuickVerificationWith2Clients(self):
-        perstorage = self.openClientStorage(cache="test")
+        perstorage = self.openClientStorage(cache="test", cache_size=4000)
         self.assertEqual(perstorage.verify_result, "empty cache")
 
         self._storage = self.openClientStorage()
@@ -610,14 +610,19 @@
         revid2 = self._dostore(oid2)
         revid2 = self._dostore(oid2, revid2)
 
-        # sync() is needed to prevent invalidation for oid from arriving
-        # in the middle of the load() call.
-        perstorage.sync()
         perstorage.load(oid, '')
         perstorage.close()
 
+        forker.wait_until(lambda : os.path.exists('test-1.zec'))
+
         revid = self._dostore(oid, revid)
+
         perstorage = self.openClientStorage(cache="test")
+
+        forker.wait_until(
+            (lambda : perstorage.verify_result == "quick verification"),
+            onfail=(lambda : None))
+
         self.assertEqual(perstorage.verify_result, "quick verification")
         self.assertEqual(perstorage._server._last_invals,
                          (revid, [oid]))

Modified: ZODB/trunk/src/ZEO/tests/protocols.test
===================================================================
--- ZODB/trunk/src/ZEO/tests/protocols.test	2010-05-13 19:06:44 UTC (rev 112293)
+++ ZODB/trunk/src/ZEO/tests/protocols.test	2010-05-13 19:06:45 UTC (rev 112294)
@@ -47,11 +47,11 @@
     >>> conn2.root()['blob2'].open('w').write('blob data 2')
     >>> transaction.commit()
 
+    >>> @wait_until("Get the new data")
+    ... def f():
+    ...     conn.sync()
+    ...     return conn.root().x == 5
 
-    >>> conn.sync()
-    >>> conn.root().x
-    5
-
     >>> db.close()
 
     >>> for i in range(2):
@@ -132,9 +132,10 @@
     >>> transaction.commit()
 
 
-    >>> conn.sync()
-    >>> conn.root().x
-    5
+    >>> @wait_until()
+    ... def x_to_be_5():
+    ...     conn.sync()
+    ...     return conn.root().x == 5
 
     >>> db.close()
 



More information about the Zodb-checkins mailing list