Commit 0875dbee authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f778db65
......@@ -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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment