[Zope-Checkins] CVS: ZODB3/ZODB/tests - RecoveryStorage.py:1.8.10.2

Tim Peters tim.one at comcast.net
Thu Aug 14 16:41:31 EDT 2003


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv28726/ZODB/tests

Modified Files:
      Tag: ZODB3-3_1-branch
	RecoveryStorage.py 
Log Message:
New test checkPackWithGCOnDestinationAfterRestore, backported from
ZODB4.


=== ZODB3/ZODB/tests/RecoveryStorage.py 1.8.10.1 => 1.8.10.2 ===
--- ZODB3/ZODB/tests/RecoveryStorage.py:1.8.10.1	Thu Jul 24 14:49:03 2003
+++ ZODB3/ZODB/tests/RecoveryStorage.py	Thu Aug 14 15:41:26 2003
@@ -2,20 +2,20 @@
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """More recovery and iterator tests."""
 
 from ZODB.Transaction import Transaction
 from ZODB.tests.IteratorStorage import IteratorDeepCompare
-from ZODB.tests.StorageTestBase import MinPO, zodb_unpickle
+from ZODB.tests.StorageTestBase import MinPO, zodb_unpickle, snooze
 from ZODB import DB
 from ZODB.referencesf import referencesf
 
@@ -72,7 +72,7 @@
             iter.close()
             self.assertEqual(data.oid, oid)
             self.assertEqual(data.data, None)
-    
+
     def checkRecoverUndoInVersion(self):
         oid = self._storage.new_oid()
         version = "aVersion"
@@ -129,7 +129,7 @@
         self._dst = self.new_dest()
         self._dst.copyTransactionsFrom(self._storage)
         self.compare(self._storage, self._dst)
-        
+
     def checkRestoreAcrossPack(self):
         db = DB(self._storage)
         c = db.open()
@@ -155,3 +155,31 @@
         it.close()
         self._dst.tpc_vote(final)
         self._dst.tpc_finish(final)
+
+    def checkPackWithGCOnDestinationAfterRestore(self):
+        raises = self.assertRaises
+        db = DB(self._storage)
+        conn = db.open()
+        root = conn.root()
+        root.obj = obj1 = MinPO(1)
+        txn = get_transaction()
+        txn.note('root -> obj')
+        txn.commit()
+        root.obj.obj = obj2 = MinPO(2)
+        txn = get_transaction()
+        txn.note('root -> obj -> obj')
+        txn.commit()
+        del root.obj
+        txn = get_transaction()
+        txn.note('root -X->')
+        txn.commit()
+        # Now copy the transactions to the destination
+        self._dst.copyTransactionsFrom(self._storage)
+        # Now pack the destination.
+        snooze()
+        self._dst.pack(time.time(),  referencesf)
+        # And check to see that the root object exists, but not the other
+        # objects.
+        data, serial = self._dst.load(root._p_oid, '')
+        raises(KeyError, self._dst.load, obj1._p_oid, '')
+        raises(KeyError, self._dst.load, obj2._p_oid, '')




More information about the Zope-Checkins mailing list