[Checkins] SVN: ZODB/branches/jim-thready-zeo2/src/ZEO/tests/InvalidationTests.py Added a test to try to stress threading a bit more.

Jim Fulton jim at zope.com
Mon Sep 21 14:46:33 EDT 2009


Log message for revision 104407:
  Added a test to try to stress threading a bit more.
  

Changed:
  U   ZODB/branches/jim-thready-zeo2/src/ZEO/tests/InvalidationTests.py

-=-
Modified: ZODB/branches/jim-thready-zeo2/src/ZEO/tests/InvalidationTests.py
===================================================================
--- ZODB/branches/jim-thready-zeo2/src/ZEO/tests/InvalidationTests.py	2009-09-21 17:59:46 UTC (rev 104406)
+++ ZODB/branches/jim-thready-zeo2/src/ZEO/tests/InvalidationTests.py	2009-09-21 18:46:33 UTC (rev 104407)
@@ -318,9 +318,9 @@
         # tearDown then immediately, but if other threads are still
         # running that can lead to a cascade of spurious exceptions.
         for t in threads:
-            t.join(10)
+            t.join(30)
         for t in threads:
-            t.cleanup()
+            t.cleanup(10)
 
     def checkConcurrentUpdates2Storages_emulated(self):
         self._storage = storage1 = self.openClientStorage()
@@ -378,6 +378,34 @@
         db1.close()
         db2.close()
 
+    def checkConcurrentUpdates19Storages(self):
+        n = 19
+        dbs = [DB(self.openClientStorage()) for i in range(n)]
+        self._storage = dbs[0].storage
+        stop = threading.Event()
+
+        cn = dbs[0].open()
+        tree = cn.root()["tree"] = OOBTree()
+        transaction.commit()
+        cn.close()
+
+        # Run threads that update the BTree
+        cd = {}
+        threads = [self.StressThread(dbs[i], stop, i, cd, i, n)
+                   for i in range(n)]
+        self.go(stop, cd, *threads)
+
+        while len(set(db.lastTransaction() for db in dbs)) > 1:
+            _ = [db._storage.sync() for db in dbs]
+
+        cn = dbs[0].open()
+        tree = cn.root()["tree"]
+        self._check_tree(cn, tree)
+        self._check_threads(tree, *threads)
+
+        cn.close()
+        _ = [db.close() for db in dbs]
+
     def checkConcurrentUpdates1Storage(self):
         self._storage = storage1 = self.openClientStorage()
         db1 = DB(storage1)



More information about the checkins mailing list