Commit 9c7241dc authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8e958049
...@@ -467,7 +467,7 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) ( ...@@ -467,7 +467,7 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
mkdir(bfroot, name, bfdir) mkdir(bfroot, name, bfdir)
mkdir(bfdir, "head", bfhead) mkdir(bfdir, "head", bfhead)
mkfile(bfhead, "data", bfdata) mkfile(bfhead, "data", bfdata)
mkfile(bfhead, "at", NewSmallFile(bf.readAt)) mkfile(bfhead, "at", NewSmallFile(bf.readAt)) // TODO mtime(at) = tidtime(at)
// XXX mkfile(bh, "invalidations", bh.inv) // XXX mkfile(bh, "invalidations", bh.inv)
return bfdir.Inode(), fuse.OK return bfdir.Inode(), fuse.OK
......
...@@ -32,13 +32,12 @@ from persistent.timestamp import TimeStamp ...@@ -32,13 +32,12 @@ from persistent.timestamp import TimeStamp
import os, os.path, subprocess import os, os.path, subprocess
from errno import EINVAL from errno import EINVAL
from time import sleep from golang import func, method, defer
from golang import func, defer
from pytest import raises from pytest import raises
testdb = None testdb = None
testzurl = None testzurl = None # URL of testdb
testmntpt = None testmntpt = None # wcfs is mounted here
def setup_module(): def setup_module():
global testdb, testzurl, testmntpt global testdb, testzurl, testmntpt
testdb = getTestDB() testdb = getTestDB()
...@@ -78,7 +77,7 @@ def tidtime(tid): ...@@ -78,7 +77,7 @@ def tidtime(tid):
# ZODB/py vs ZODB/go time resolution is not better than 1µs # ZODB/py vs ZODB/go time resolution is not better than 1µs
# see e.g. https://lab.nexedi.com/kirr/neo/commit/9112f21e # see e.g. https://lab.nexedi.com/kirr/neo/commit/9112f21e
# #
# NOTE pytest.approx supports only ==, not e.g. < # NOTE pytest.approx supports only ==, not e.g. <, so we use plain round.
return round(t, 6) return round(t, 6)
...@@ -119,6 +118,24 @@ def test_join_autostart(): ...@@ -119,6 +118,24 @@ def test_join_autostart():
assert os.path.isdir(wc.mountpoint + "/bigfile") assert os.path.isdir(wc.mountpoint + "/bigfile")
# XXX hack (tmp ?)
# Conn._sync makes sure that underlying wcfs is synced to last ZODB data
@method(wcfs.Conn)
def _sync(self):
zurl = readfile(self.mountpoint + "/.wcfs")
bigfilev = os.listdir(self.mountpoint + "/bigfile")
self.close()
subprocess.check_call(["fusermount", "-u", self.mountpoint])
c2 = wcfs.join(zurl, autostart=True)
assert c2.mountpoint == self.mountpoint
self._fwcfs = c2._fwcfs
# recreate bigfile entries
for bf in bigfilev:
os.mkdir("%s/bigfile/%s" % (self.mountpoint, bf))
# XXX parametrize zblk0, zblk1 # XXX parametrize zblk0, zblk1
# XXX select !wcfs mode so that we prepare data through !wcfs path. # XXX select !wcfs mode so that we prepare data through !wcfs path.
@func @func
...@@ -162,6 +179,7 @@ def test_bigfile_empty(): ...@@ -162,6 +179,7 @@ def test_bigfile_empty():
# head/at = last txn of whole db # head/at = last txn of whole db
assert readfile(fpath + "/head/at") == tid2.encode('hex') assert readfile(fpath + "/head/at") == tid2.encode('hex')
# TODO check head/at syncs to later non-bigfile commits # TODO check head/at syncs to later non-bigfile commits
...@@ -176,7 +194,7 @@ def test_bigfile_empty(): ...@@ -176,7 +194,7 @@ def test_bigfile_empty():
tidlast = last._p_serial tidlast = last._p_serial
# XXX force sync of wcfs - how? # XXX force sync of wcfs - how?
wcsync(wc) wc._sync()
fsize = 10*blksize + len(s) # trailing \0 not counted XXX ok? -> XXX not ok fsize = 10*blksize + len(s) # trailing \0 not counted XXX ok? -> XXX not ok
......
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