Commit 008211fb authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Levin Zimmermann

wcfs: tests: Factor assertion that process should be killed into assertKilled

We will need to use this utilitin from several places in the next patch.

/reviewed-by @levin.zimmermann
/reviewed-on nexedi/wendelin.core!18
parent 82aa5949
...@@ -236,13 +236,7 @@ def _bad_watch_no_pin_reply(ctx, f, at): ...@@ -236,13 +236,7 @@ def _bad_watch_no_pin_reply(ctx, f, at):
f.cout.send(req.msg) f.cout.send(req.msg)
# sleep > wcfs pin timeout - wcfs must kill us # sleep > wcfs pin timeout - wcfs must kill us
_, _rx = select( f.assertKilled(ctx, "wcfs did not kill stuck client")
ctx.done().recv, # 0
time.after(2*f.pintimeout).recv, # 1
)
if _ == 0:
raise ctx.err()
raise AssertionError("wcfs did not kill stuck client")
wg.go(_) wg.go(_)
wg.wait() wg.wait()
...@@ -272,3 +266,16 @@ def test_wcfs_pintimeout_kill(with_prompt_pintimeout): ...@@ -272,3 +266,16 @@ def test_wcfs_pintimeout_kill(with_prompt_pintimeout):
# the faulty client must become killed by wcfs # the faulty client must become killed by wcfs
p.join(t.ctx) p.join(t.ctx)
assert p.exitcode is not None assert p.exitcode is not None
# assertKilled assert that the current process becomes killed after time goes after pintimeout.
@func(tFaultyClient)
def assertKilled(f, ctx, failmsg):
# sleep > wcfs pin timeout - wcfs must kill us
_, _rx = select(
ctx.done().recv, # 0
time.after(2*f.pintimeout).recv, # 1
)
if _ == 0:
raise ctx.err()
raise AssertionError(failmsg)
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