Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
b59b2b9d
Commit
b59b2b9d
authored
Mar 17, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add two new pack+undo+versions tests, one of which fails for FileStorage.
parent
1f4e5bb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
1 deletion
+98
-1
src/ZODB/tests/VersionStorage.py
src/ZODB/tests/VersionStorage.py
+93
-1
src/ZODB/tests/testFileStorage.py
src/ZODB/tests/testFileStorage.py
+5
-0
No files found.
src/ZODB/tests/VersionStorage.py
View file @
b59b2b9d
...
...
@@ -20,10 +20,14 @@ Any storage that supports versions should be able to pass all these tests.
# They were introduced when Jim reviewed the original version of the
# code. Barry and Jeremy didn't understand versions then.
import
time
from
ZODB
import
POSException
from
ZODB.referencesf
import
referencesf
from
ZODB.Transaction
import
Transaction
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
,
snooze
from
ZODB
import
DB
class
VersionStorage
:
...
...
@@ -376,3 +380,91 @@ class VersionStorage:
self
.
_storage
.
tpc_vote
(
t
)
self
.
_storage
.
tpc_finish
(
t
)
self
.
assertEqual
(
oids
,
[
oid
])
def
checkPackVersions
(
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
()
# 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
()
snooze
()
self
.
_storage
.
pack
(
time
.
time
(),
referencesf
)
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
(),
referencesf
)
def
checkPackVersionsInPast
(
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
,
referencesf
)
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
(),
referencesf
)
src/ZODB/tests/testFileStorage.py
View file @
b59b2b9d
...
...
@@ -167,6 +167,11 @@ class FileStorageTests(
self
.
failUnless
(
self
.
_storage
.
_records_before_save
>
20
)
def
checkPackVersionsInPast
(
self
):
# FileStorage can't cope with backpointers to objects
# created in versions. Must fix.
pass
class
FileStorageRecoveryTest
(
StorageTestBase
.
StorageTestBase
,
RecoveryStorage
.
RecoveryStorage
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment