Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
4ff147d1
Commit
4ff147d1
authored
Jun 27, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dfb82ecc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+21
-4
No files found.
wcfs/wcfs_test.py
View file @
4ff147d1
...
@@ -22,7 +22,10 @@ from wendelin.lib.testing import getTestDB
...
@@ -22,7 +22,10 @@ from wendelin.lib.testing import getTestDB
from
wendelin.bigfile.file_zodb
import
ZBigFile
from
wendelin.bigfile.file_zodb
import
ZBigFile
from
wendelin.bigfile.tests.test_filezodb
import
blksize
from
wendelin.bigfile.tests.test_filezodb
import
blksize
from
wendelin
import
wcfs
from
wendelin
import
wcfs
import
transaction
import
transaction
from
persistent
import
Persistent
from
persistent.timestamp
import
TimeStamp
import
os
,
os
.
path
,
subprocess
import
os
,
os
.
path
,
subprocess
from
pytest
import
raises
from
pytest
import
raises
...
@@ -62,6 +65,11 @@ def readfile(path):
...
@@ -62,6 +65,11 @@ def readfile(path):
with
open
(
path
)
as
f
:
with
open
(
path
)
as
f
:
return
f
.
read
()
return
f
.
read
()
# ttime converts tid to transaction commit time.
def
ttime
(
tid
):
return
TimeStamp
(
tid
).
timeTime
()
# check that zurl does not change from one open to another storage open.
# check that zurl does not change from one open to another storage open.
def
test_zurlstable
():
def
test_zurlstable
():
for
i
in
range
(
10
):
for
i
in
range
(
10
):
...
@@ -106,10 +114,18 @@ def test_join_autostart():
...
@@ -106,10 +114,18 @@ def test_join_autostart():
def
test_bigfile_empty
():
def
test_bigfile_empty
():
root
=
testdb
.
dbopen
()
root
=
testdb
.
dbopen
()
root
[
'zfile'
]
=
f
=
ZBigFile
(
blksize
)
root
[
'zfile'
]
=
f
=
ZBigFile
(
blksize
)
# NOTE there is no clean way to retrieve tid of just committed transaction
# we'll be using last._p_serial as workaround.
root
[
'last'
]
=
last
=
Persistent
()
transaction
.
commit
()
transaction
.
commit
()
tid1
=
last
.
_p_serial
root
[
'aaa'
]
=
'bbb'
last
.
_p_changed
=
1
transaction
.
commit
()
transaction
.
commit
()
tid2
=
last
.
_p_serial
assert
ttime
(
tid2
)
>
ttime
(
tid1
)
wc
=
wcfs
.
join
(
testzurl
,
autostart
=
True
)
wc
=
wcfs
.
join
(
testzurl
,
autostart
=
True
)
...
@@ -117,10 +133,11 @@ def test_bigfile_empty():
...
@@ -117,10 +133,11 @@ def test_bigfile_empty():
fpath
=
"%s/bigfile/%s"
%
(
wc
.
mountpoint
,
f
.
_p_oid
.
encode
(
'hex'
))
fpath
=
"%s/bigfile/%s"
%
(
wc
.
mountpoint
,
f
.
_p_oid
.
encode
(
'hex'
))
os
.
mkdir
(
fpath
)
os
.
mkdir
(
fpath
)
os
.
stat
(
fpath
+
"/head/data"
)
st
=
os
.
stat
(
fpath
+
"/head/data"
)
assert
st
.
st_size
==
0
assert
st
.
st_mtime
==
ttime
(
tid1
)
# XXX size(head/data) = 0
assert
readfile
(
fpath
+
"/head/at"
)
==
'txn2'
# XXX mtime(head/data) ~= last txn that changed bigdile
# XXX head/at = last txn of whole db
# XXX head/at = last txn of whole db
...
...
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