[Zodb-checkins] CVS: StandaloneZODB/ZEO/tests - testZEO.py:1.1.2.17

Jeremy Hylton jeremy@zope.com
Tue, 8 Jan 2002 13:12:57 -0500


Update of /cvs-repository/StandaloneZODB/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv2213

Modified Files:
      Tag: ZEO-ZRPC-Dev
	testZEO.py 
Log Message:
Enable ReadOnlyStorage tests for ZEO.


=== StandaloneZODB/ZEO/tests/testZEO.py 1.1.2.16 => 1.1.2.17 ===
      TransactionalUndoStorage, TransactionalUndoVersionStorage, \
      PackableStorage, Synchronization, ConflictResolution, RevisionStorage, \
-     MTStorage
+     MTStorage, ReadOnlyStorage
 from ZODB.tests.MinPO import MinPO
 from ZODB.tests.StorageTestBase import zodb_unpickle
 
@@ -137,6 +137,7 @@
                    PackableStorage.PackableStorage,
                    Synchronization.SynchronizedStorage,
                    MTStorage.MTStorage,
+                   ReadOnlyStorage.ReadOnlyStorage,
                    ):
     """An abstract base class for ZEO tests
 
@@ -183,6 +184,15 @@
         self.__fs_base = tempfile.mktemp()
         self.__super_setUp()
 
+    def open(self, read_only=0):
+        # XXX Needed to support ReadOnlyStorage tests.  Ought to be a
+        # cleaner way.
+        
+        # Is this the only way to get the address?
+        addr = self._storage._rpc_mgr.addr
+        self._storage.close()
+        self._storage = ZEO.ClientStorage.ClientStorage(addr, read_only=1)
+
     def getStorage(self):
         return FileStorage(self.__fs_base, create=1)
 
@@ -372,7 +382,8 @@
         base = ZEO.ClientStorage.ClientStorage(self.addr,
                                                client=cache,
                                                cache_size=cache_size,
-                                               wait_for_server_on_startup=wait)
+                                               wait_for_server_on_startup=wait,
+                                               min_disconnect_poll=0.1)
         storage = PackWaitWrapper(base)
         storage.registerDB(DummyDB(), None)
         return storage