[Zope3-checkins] CVS: ZODB4/src/zodb/storage/tests - recovery.py:1.4.4.1

Barry Warsaw barry@wooz.org
Mon, 10 Mar 2003 14:40:16 -0500


Update of /cvs-repository/ZODB4/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv15647

Modified Files:
      Tag: opaque-pickles-branch
	recovery.py 
Log Message:
checkPackWithGCOnDestinationAfterRestore(): New test


=== ZODB4/src/zodb/storage/tests/recovery.py 1.4 => 1.4.4.1 ===
--- ZODB4/src/zodb/storage/tests/recovery.py:1.4	Wed Feb  5 18:28:27 2003
+++ ZODB4/src/zodb/storage/tests/recovery.py	Mon Mar 10 14:40:15 2003
@@ -157,3 +157,30 @@
                               final)
         self._dst.tpcVote(final)
         self._dst.tpcFinish(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
+        self._dst.pack(time.time())
+        # 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, '')