Commit d1fc5e8c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bfad5de1
...@@ -436,8 +436,10 @@ class tFile: ...@@ -436,8 +436,10 @@ class tFile:
# assertBlk asserts that file block #blk has data as expected. # assertBlk asserts that file block #blk has data as expected.
# #
# Expected data may be given with size < t.blksize. In such case the data # Expected data may be given with size < t.blksize. In such case the data
# is implicitly appended with trailing zeros. # is implicitly appended with trailing zeros. Data can be both bytes and unicode.
def assertBlk(t, blk, data): def assertBlk(t, blk, data):
if not isinstance(data, bytes):
data = data.encode('utf-8')
assert len(data) <= t.blksize assert len(data) <= t.blksize
data += b'\0'*(t.blksize - len(data)) # tailing zeros data += b'\0'*(t.blksize - len(data)) # tailing zeros
assert blk < t._sizeinblk() assert blk < t._sizeinblk()
...@@ -767,7 +769,6 @@ def watch(twlink, zf, at): # XXX -> ? ...@@ -767,7 +769,6 @@ def watch(twlink, zf, at): # XXX -> ?
# if replyok ends with '…' only reply prefix until the dots is checked. # if replyok ends with '…' only reply prefix until the dots is checked.
@func(tWatchLink) @func(tWatchLink)
def _watch(twlink, zf, at, pinok, replyok): def _watch(twlink, zf, at, pinok, replyok):
# send watch request and check that we receive pins for in-cache blocks # send watch request and check that we receive pins for in-cache blocks
# changed > at. Use timeout to detect wcfs replying less pins than expected. # changed > at. Use timeout to detect wcfs replying less pins than expected.
# #
...@@ -956,10 +957,11 @@ def test_wcfs(): ...@@ -956,10 +957,11 @@ def test_wcfs():
wl = t.openwatch() wl = t.openwatch()
wl.watch(zf, t.head) wl.watch(zf, t.head)
f.assertCache([1,1,1,1]) f.assertCache([1,1,1,1])
# t.change(zf, {0: '4a', 2: '4c', 5: '4f'}) FIXME enable 4a after δbtree works t.change(zf, { 2: '4c', 5: '4f'}) # FIXME + 4a after δbtree works
t.change(zf, { 2: '4c', 5: '4f'})
at4 = t.commit() at4 = t.commit()
f.assertCache([1,1,0,1,0,0]) # FIXME a must be invalidated - see ^^^ f.assertCache([1,1,0,1,0,0]) # FIXME a must be invalidated - see ^^^
f.assertBlk(2, '4c') -> pin 2
# XXX commit after current file size -> watch # XXX commit after current file size -> watch
......
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