Commit 415ee15f authored by Levin Zimmermann's avatar Levin Zimmermann

x wip test kill in readpinwatchers (use zeo as we need more clients. should be...

x wip test kill in readpinwatchers (use zeo as we need more clients. should be cleaner, not changing hardcoded default)
parent 9132d766
...@@ -346,7 +346,7 @@ DB_4TESTS_REGISTRY = { ...@@ -346,7 +346,7 @@ DB_4TESTS_REGISTRY = {
} }
def getTestDB(): def getTestDB():
testdb_uri = os.environ.get('WENDELIN_CORE_TEST_DB', '<fs>') testdb_uri = os.environ.get('WENDELIN_CORE_TEST_DB', '<zeo>')
testdb_factory = DB_4TESTS_REGISTRY.get(testdb_uri, TestDB_External) testdb_factory = DB_4TESTS_REGISTRY.get(testdb_uri, TestDB_External)
testdb = testdb_factory(testdb_uri) testdb = testdb_factory(testdb_uri)
......
...@@ -1449,6 +1449,44 @@ def test_wcfs_watch_going_back(): ...@@ -1449,6 +1449,44 @@ def test_wcfs_watch_going_back():
wl.close() wl.close()
# xxx todo
@func
def test_wcfs_pintimeout_kill_in_readPinWatchers():
tkill = 32*time.second
t = tDB(timeout=tkill*2); zf = t.zfile
defer(t.close)
at1 = t.commit(zf, {2:'c1'})
at2 = t.commit(zf, {2:'c2'})
f = t.open(zf)
f.assertData(['','','c2'])
ctx, _ = context.with_timeout(context.background(), 2*tkill)
wl = t.openwatch()
wg = sync.WorkGroup(ctx)
def _(ctx):
res = wl.sendReq(ctx, b"watch %s @%s" % (h(zf._p_oid), h(at1)))
assert res == 'ok'
wg.go(_)
def _(ctx):
req = wl.recvReq(ctx)
wl.replyReq(ctx, req, 'ack')
wg.go(_)
wg.wait()
# now we need to trigger 'readPinWatchers':
# Read() -> BigFile.readBlk() -> BigFile.readPinWatchers()
lwc = wcfs.join(testzurl, autostart=False)
bff = open(lwc.mountpoint+'/head'+'/bigfile'+'/0000000000000002', 'r')
defer(bff.close)
x = bff.read()
# req = wl.recvReq(ctx)
# tdb = testdb.dbopen()
from pdb import set_trace as bp
bp()
# TODO extend tests to also cover situation that a non-faulty # TODO extend tests to also cover situation that a non-faulty
# client continues to be served ok # client continues to be served ok
# TODO explicitly cover readPinWatchers behaviour with tests # TODO explicitly cover readPinWatchers behaviour with tests
......
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