[Checkins] SVN: gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py Adding a test to verify that the new changes actually apply as predicted

Dirceu Pereira Tiegs dirceutiegs at gmail.com
Wed Jun 18 06:58:47 EDT 2008


Log message for revision 87506:
  Adding a test to verify that the new changes actually apply as predicted

Changed:
  U   gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py

-=-
Modified: gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py
===================================================================
--- gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py	2008-06-18 10:49:31 UTC (rev 87505)
+++ gocept.zeoraid/branches/distributed-remote-calls/src/gocept/zeoraid/tests/test_basics.py	2008-06-18 10:58:46 UTC (rev 87506)
@@ -70,7 +70,16 @@
 
 class ZEOStorageBackendTests(StorageTestBase.StorageTestBase):
 
+    def logApplyStorageCalls(self, fn, *args, **kwargs):
+        l = self._log
+        def loggedMethod(*args, **kwargs):
+            storage_name = str([i.name for i in args[1]])
+            l.append("Calling %s on Storage %s" % (fn.__name__, storage_name))
+            return fn(*args, **kwargs)
+        return loggedMethod
+
     def open(self, **kwargs):
+        gocept.zeoraid.storage.RAIDStorage = self.logApplyStorageCalls(gocept.zeoraid.storage.RAIDStorage)
         self._storage = gocept.zeoraid.storage.RAIDStorage('teststorage',
                                                            self._storages, **kwargs)
 
@@ -79,6 +88,7 @@
         self._servers = []
         self._pids = []
         self._storages = []
+        self._log = []
         for i in xrange(5):
             port = get_port()
             zconf = forker.ZEOConfig(('', port))
@@ -1371,9 +1381,19 @@
     pass
 
 
+class DistributedCallsTests(ZEOStorageBackendTests):
+    def test_getSize_calls(self):
+        for i in range(20):
+            self._storage.getSize()
+        print
+        print "XXXXXXXXXXXXXX"
+        print self._log
+        print "XXXXXXXXXXXXXX"
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(ZEOReplicationStorageTests, "check"))
     suite.addTest(unittest.makeSuite(FailingStorageTests))
     suite.addTest(unittest.makeSuite(FailingStorageSharedBlobTests))
+    suite.addTest(unittest.makeSuite(DistributedCallsTests))
     return suite



More information about the Checkins mailing list