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
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
Joshua
wendelin.core
Commits
0875dbee
Commit
0875dbee
authored
Mar 12, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f778db65
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+31
-18
No files found.
wcfs/wcfs_test.py
View file @
0875dbee
...
...
@@ -36,6 +36,10 @@ from golang import func, method, defer
from
zodbtools.util
import
ashex
as
h
,
fromhex
from
pytest
import
raises
# setup:
# - create test database, compute zurl and mountpoint for wcfs
# - at every test: make sure wcfs is not running before & after the test.
testdb
=
None
testzurl
=
None
# URL of testdb
testmntpt
=
None
# wcfs is mounted here
...
...
@@ -66,21 +70,7 @@ def teardown_function(f):
os
.
rmdir
(
testmntpt
)
# readfile reads file @ path.
def
readfile
(
path
):
with
open
(
path
)
as
f
:
return
f
.
read
()
# tidtime converts tid to transaction commit time.
def
tidtime
(
tid
):
t
=
TimeStamp
(
tid
).
timeTime
()
# ZODB/py vs ZODB/go time resolution is not better than 1µs
# see e.g. https://lab.nexedi.com/kirr/neo/commit/9112f21e
#
# NOTE pytest.approx supports only ==, not e.g. <, so we use plain round.
return
round
(
t
,
6
)
# ---- tests ----
# check that zurl does not change from one open to another storage open.
def
test_zurlstable
():
...
...
@@ -90,6 +80,7 @@ def test_zurlstable():
zstor
.
close
()
assert
zurl
==
testzurl
# test that join works.
@
func
def
test_join
():
zurl
=
testzurl
...
...
@@ -107,6 +98,7 @@ def test_join():
defer
(
wc2
.
close
)
assert
wc2
.
mountpoint
==
wc
.
mountpoint
# test that join(autostart=y) works.
@
func
def
test_join_autostart
():
zurl
=
testzurl
...
...
@@ -121,7 +113,8 @@ def test_join_autostart():
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head/bigfile"
)
# XXX parametrize zblk0, zblk1
# XXX test
# XXX parametrize zblk0, zblk1 XXX or just rely on tox?
@
func
def
test_wcfs
():
root
=
testdb
.
dbopen
()
...
...
@@ -204,8 +197,6 @@ def test_wcfs():
s
=
b"hello world"
memcpy
(
vma
,
s
)
print
(
"
\
n
\
n
\
n
"
)
#import time; time.sleep(2)
commit
()
wcsync
()
# sync wcfs to ZODB
...
...
@@ -279,3 +270,25 @@ def test_wcfs():
# TODO pagecache state after loading (via mincore)
def
test_wcfs_invproto
():
# XXX
pass
# ---- misc ---
# readfile reads file @ path.
def
readfile
(
path
):
with
open
(
path
)
as
f
:
return
f
.
read
()
# tidtime converts tid to transaction commit time.
def
tidtime
(
tid
):
t
=
TimeStamp
(
tid
).
timeTime
()
# ZODB/py vs ZODB/go time resolution is not better than 1µs
# see e.g. https://lab.nexedi.com/kirr/neo/commit/9112f21e
#
# NOTE pytest.approx supports only ==, not e.g. <, so we use plain round.
return
round
(
t
,
6
)
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