[Zodb-checkins] CVS: Zope3/src/zodb/storage/tests - version.py:1.7.4.2

Jeremy Hylton jeremy at zope.com
Thu Apr 17 16:55:34 EDT 2003


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

Modified Files:
      Tag: jeremy-new-pack-branch
	version.py 
Log Message:
Add tests for objects created in versions that are unreachable at the
pack time.


=== Zope3/src/zodb/storage/tests/version.py 1.7.4.1 => 1.7.4.2 ===
--- Zope3/src/zodb/storage/tests/version.py:1.7.4.1	Mon Apr 14 18:53:38 2003
+++ Zope3/src/zodb/storage/tests/version.py	Thu Apr 17 15:55:33 2003
@@ -395,3 +395,64 @@
         txn.commit()
 
         self._storage.pack(time.time())
+
+    def testPackVersionReachable(self):
+        db = DB(self._storage)
+        cn = db.open()
+        root = cn.root()
+
+        names = "a", "b", "c"
+
+        for name in names:
+            root[name] = MinPO(name)
+            get_transaction().commit()
+
+        for name in names:
+            cn2 = db.open(version=name)
+            rt2 = cn2.root()
+            obj = rt2[name]
+            obj.value = MinPO("version")
+            get_transaction().commit()
+            cn2.close()
+
+        root["d"] = MinPO("d")
+        get_transaction().commit()
+
+        self._storage.pack(time.time())
+        cn.sync()
+        cn._cache.clear()
+
+        # make sure all the non-version data is there
+        for name, obj in root.items():
+            self.assertEqual(name, obj.value)
+
+        # make sure all the version-data is there,
+        # and create a new revision in the version
+        for name in names:
+            cn2 = db.open(version=name)
+            rt2 = cn2.root()
+            obj = rt2[name].value
+            self.assertEqual(obj.value, "version")
+            obj.value = "still version"
+            get_transaction().commit()
+            cn2.close()
+
+        db.abortVersion("b")
+        txn = get_transaction()
+        txn.note("abort version b")
+        txn.commit()
+
+        t = time.time()
+        snooze()
+        
+        L = db.undoInfo()
+        db.undo(L[0]["id"])
+        txn = get_transaction()
+        txn.note("undo abort")
+        txn.commit()
+        
+        self._storage.pack(t)
+
+        cn2 = db.open(version="b")
+        rt2 = cn2.root()
+        print rt2["b"].value.value




More information about the Zodb-checkins mailing list