Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
613dbf6a
Commit
613dbf6a
authored
Mar 06, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
928ad0b8
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
70 deletions
+87
-70
t/neo/storage/fs1/py/gen-testdata
t/neo/storage/fs1/py/gen-testdata
+28
-11
t/neo/storage/fs1/testdata_expect_test.go
t/neo/storage/fs1/testdata_expect_test.go
+59
-59
No files found.
t/neo/storage/fs1/py/gen-testdata
View file @
613dbf6a
...
@@ -39,11 +39,15 @@ def xtime():
...
@@ -39,11 +39,15 @@ def xtime():
time
.
time
=
xtime
time
.
time
=
xtime
def
commit
(
user
,
description
,
extension
):
def
pre
commit
(
user
,
description
,
extension
):
txn
=
transaction
.
get
()
txn
=
transaction
.
get
()
txn
.
user
=
user
txn
.
user
=
user
txn
.
description
=
description
txn
.
description
=
description
txn
.
extension
=
extension
txn
.
extension
=
extension
return
txn
def
commit
(
user
,
description
,
extension
):
txn
=
precommit
(
user
,
description
,
extension
)
txn
.
commit
()
txn
.
commit
()
class
Object
(
Persistent
):
class
Object
(
Persistent
):
...
@@ -62,17 +66,17 @@ def main():
...
@@ -62,17 +66,17 @@ def main():
outfs
=
"testdata/1.fs"
outfs
=
"testdata/1.fs"
stor
=
FileStorage
(
outfs
,
create
=
True
)
db
=
DB
(
stor
)
conn
=
db
.
open
()
root
=
conn
.
root
()
assert
root
.
_p_oid
==
p64
(
0
),
`root._p_oid`
# generate random changes to objects hooked to top-level root by a/b/c/... key
# generate random changes to objects hooked to top-level root by a/b/c/... key
random
.
seed
(
0
)
random
.
seed
(
0
)
namev
=
[
_
for
_
in
"abcdefg"
]
namev
=
[
_
for
_
in
"abcdefg"
]
for
i
in
range
(
2
):
for
i
in
range
(
2
):
stor
=
FileStorage
(
outfs
,
create
=
(
i
==
0
))
db
=
DB
(
stor
)
conn
=
db
.
open
()
root
=
conn
.
root
()
assert
root
.
_p_oid
==
p64
(
0
),
`root._p_oid`
for
j
in
range
(
25
):
for
j
in
range
(
25
):
name
=
random
.
choice
(
namev
)
name
=
random
.
choice
(
namev
)
if
name
in
root
:
if
name
in
root
:
...
@@ -92,11 +96,24 @@ def main():
...
@@ -92,11 +96,24 @@ def main():
u"undo %i.%i
\
n
more detailed description
\
n
\
n
zzz ..."
%
(
i
,
j
)
+
"
\
t
"
*
(
i
+
j
),
u"undo %i.%i
\
n
more detailed description
\
n
\
n
zzz ..."
%
(
i
,
j
)
+
"
\
t
"
*
(
i
+
j
),
{
"x-generator"
:
"zodb/py2 (undo %s)"
%
ul
[
"id"
]})
{
"x-generator"
:
"zodb/py2 (undo %s)"
%
ul
[
"id"
]})
# TODO delete an object
# delete an object
#obj = random.choice(root.values())
#txn = precommit(u"root%i\nYour\nRoyal\nMagesty " % i,
# u"delete %i\nalpha beta gamma\n\nqqq ..." % i,
# {"x-generator": "zodb/py2 (delete %s)" % hex64(obj._p_oid)})
#stor.tpc_begin(txn)
#stor.deleteObject(obj._p_oid, obj._p_serial, txn)
#stor.tpc_vote(txn)
#stor.tpc_finish(txn)
# close db & rest not to get conflict errors after we touched stor
# directly a bit. everything will be reopened on next iteration.
conn
.
close
()
db
.
close
()
stor
.
close
()
conn
.
close
()
# TODO different txn status
db
.
close
()
stor
.
close
()
# dump to go what to expect
# dump to go what to expect
with
open
(
"testdata_expect_test.go"
,
"w"
)
as
f
:
with
open
(
"testdata_expect_test.go"
,
"w"
)
as
f
:
...
...
t/neo/storage/fs1/testdata_expect_test.go
View file @
613dbf6a
This diff is collapsed.
Click to expand it.
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