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

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <[email protected]>
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()
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.