[Zope-Checkins] CVS: ZODB3/ZEO/tests - ThreadTests.py:1.5

Guido van Rossum guido@python.org
Thu, 3 Oct 2002 13:47:51 -0400


Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv2514

Modified Files:
	ThreadTests.py 
Log Message:
Add a test (checkMTStores) that runs 5 threads which each do a mixture
of small and large stores, to try and trigger bugs in the
parallel-call feature.


=== ZODB3/ZEO/tests/ThreadTests.py 1.4 => 1.5 ===
--- ZODB3/ZEO/tests/ThreadTests.py:1.4	Thu Aug 29 12:32:51 2002
+++ ZODB3/ZEO/tests/ThreadTests.py	Thu Oct  3 13:47:50 2002
@@ -145,3 +145,25 @@
         self.assertEqual(thread1.gotValueError, 1)
         self.assertEqual(thread2.gotValueError, 1)
         self.assertEqual(thread2.gotDisconnected, 1)
+
+    # Run a bunch of threads doing small and large stores in parallel
+    def checkMTStores(self):
+        threads = []
+        for i in range(5):
+            t = threading.Thread(target=self.mtstorehelper)
+            threads.append(t)
+            t.start()
+        for t in threads:
+            t.join(30)
+        for i in threads:
+            self.failUnless(not t.isAlive())
+
+    # Helper for checkMTStores
+    def mtstorehelper(self):
+        name = threading.currentThread().getName()
+        objs = []
+        for i in range(10):
+            objs.append(MinPO("X" * 200000))
+            objs.append(MinPO("X"))
+        for obj in objs:
+            self._dostore(data=obj)