[Zope3-checkins] CVS: Zope3/src/zodb/storage/tests - version.py:1.7.4.1
Jeremy Hylton
jeremy@zope.com
Mon, 14 Apr 2003 18:54:09 -0400
Update of /cvs-repository/Zope3/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv1009/storage/tests
Modified Files:
Tag: jeremy-new-pack-branch
version.py
Log Message:
Completed rewrite of pack.
The code is still a mess, but it passes the tests. Need to sit on it
for a while, then do a code review.
Add testPackVersionsInPast() which failed with the old pack. Still
need to get Dieter's failing test included.
=== Zope3/src/zodb/storage/tests/version.py 1.7 => 1.7.4.1 ===
--- Zope3/src/zodb/storage/tests/version.py:1.7 Thu Mar 20 18:01:41 2003
+++ Zope3/src/zodb/storage/tests/version.py Mon Apr 14 18:53:38 2003
@@ -336,7 +336,51 @@
snooze()
self._storage.pack(time.time())
+
+ db.commitVersion("testversion")
+ txn = get_transaction()
+ txn.note("commit version")
+ txn.commit()
+
+ cn = db.open()
+ root = cn.root()
+ root["obj"] = "no version"
+
+ txn = get_transaction()
+ txn.note("modify obj")
+ txn.commit()
+
+ self._storage.pack(time.time())
+ def testPackVersionsInPast(self):
+ db = DB(self._storage)
+ cn = db.open(version="testversion")
+ root = cn.root()
+
+ obj = root["obj"] = MinPO("obj")
+ root["obj2"] = MinPO("obj2")
+ txn = get_transaction()
+ txn.note("create 2 objs in version")
+ txn.commit()
+
+ obj.value = "77"
+ txn = get_transaction()
+ txn.note("modify obj in version")
+ txn.commit()
+
+ t0 = time.time()
+ snooze()
+
+ # undo the modification to generate a mix of backpointers
+ # and versions for pack to chase
+ info = db.undoInfo()
+ db.undo(info[0]["id"])
+ txn = get_transaction()
+ txn.note("undo modification")
+ txn.commit()
+
+ self._storage.pack(t0)
+
db.commitVersion("testversion")
txn = get_transaction()
txn.note("commit version")
@@ -351,4 +395,3 @@
txn.commit()
self._storage.pack(time.time())
-