forked from goodboy/tractor
Use `assert_before` more extensively
parent
6b8c193221
commit
0b4fc4fc47
|
@ -376,10 +376,11 @@ def test_multi_subactors(
|
|||
spawn,
|
||||
ctlc: bool,
|
||||
):
|
||||
"""
|
||||
Multiple subactors, both erroring and breakpointing as well as
|
||||
a nested subactor erroring.
|
||||
"""
|
||||
'''
|
||||
Multiple subactors, both erroring and
|
||||
breakpointing as well as a nested subactor erroring.
|
||||
|
||||
'''
|
||||
child = spawn(r'multi_subactors')
|
||||
|
||||
# scan for the pdbpp prompt
|
||||
|
@ -418,10 +419,10 @@ def test_multi_subactors(
|
|||
# 2nd name_error failure
|
||||
child.expect(r"\(Pdb\+\+\)")
|
||||
|
||||
# XXX: lol honestly no idea why CI is suck a cuck
|
||||
from conftest import _ci_env
|
||||
name = 'name_error' if _ci_env else 'name_error_1'
|
||||
|
||||
# XXX: lol honestly no idea why CI is cuck but
|
||||
# seems like this likely falls into our unhandled nested
|
||||
# case and isn't working in that env due to raciness..
|
||||
name = 'name_error' if ctlc else 'name_error_1'
|
||||
assert_before(child, [
|
||||
f"Attaching to pdb in crashed actor: ('{name}'",
|
||||
"NameError",
|
||||
|
@ -455,11 +456,11 @@ def test_multi_subactors(
|
|||
do_ctlc(child)
|
||||
|
||||
# 2nd depth nursery should trigger
|
||||
# child.sendline('c')
|
||||
# child.expect(r"\(Pdb\+\+\)")
|
||||
# before = str(child.before.decode())
|
||||
assert spawn_err in before
|
||||
assert "RemoteActorError: ('name_error_1'" in before
|
||||
if not ctlc:
|
||||
assert_before(child, [
|
||||
spawn_err,
|
||||
"RemoteActorError: ('name_error_1'",
|
||||
])
|
||||
|
||||
# now run some "continues" to show re-entries
|
||||
for _ in range(5):
|
||||
|
@ -471,14 +472,17 @@ def test_multi_subactors(
|
|||
child.expect(r"\(Pdb\+\+\)")
|
||||
before = str(child.before.decode())
|
||||
|
||||
# debugger attaches to root
|
||||
assert "Attaching to pdb in crashed actor: ('root'" in before
|
||||
# expect a multierror with exceptions for each sub-actor
|
||||
assert "RemoteActorError: ('breakpoint_forever'" in before
|
||||
assert "RemoteActorError: ('name_error'" in before
|
||||
assert "RemoteActorError: ('spawn_error'" in before
|
||||
assert "RemoteActorError: ('name_error_1'" in before
|
||||
assert 'bdb.BdbQuit' in before
|
||||
assert_before(child, [
|
||||
# debugger attaches to root
|
||||
"Attaching to pdb in crashed actor: ('root'",
|
||||
|
||||
# expect a multierror with exceptions for each sub-actor
|
||||
"RemoteActorError: ('breakpoint_forever'",
|
||||
"RemoteActorError: ('name_error'",
|
||||
"RemoteActorError: ('spawn_error'",
|
||||
"RemoteActorError: ('name_error_1'",
|
||||
'bdb.BdbQuit',
|
||||
])
|
||||
|
||||
if ctlc:
|
||||
do_ctlc(child)
|
||||
|
@ -486,13 +490,15 @@ def test_multi_subactors(
|
|||
# process should exit
|
||||
child.sendline('c')
|
||||
child.expect(pexpect.EOF)
|
||||
|
||||
# repeat of previous multierror for final output
|
||||
before = str(child.before.decode())
|
||||
assert "RemoteActorError: ('breakpoint_forever'" in before
|
||||
assert "RemoteActorError: ('name_error'" in before
|
||||
assert "RemoteActorError: ('spawn_error'" in before
|
||||
assert "RemoteActorError: ('name_error_1'" in before
|
||||
assert 'bdb.BdbQuit' in before
|
||||
assert_before(child, [
|
||||
"RemoteActorError: ('breakpoint_forever'",
|
||||
"RemoteActorError: ('name_error'",
|
||||
"RemoteActorError: ('spawn_error'",
|
||||
"RemoteActorError: ('name_error_1'",
|
||||
'bdb.BdbQuit',
|
||||
])
|
||||
|
||||
|
||||
def test_multi_daemon_subactors(
|
||||
|
@ -608,7 +614,6 @@ def test_multi_subactors_root_errors(
|
|||
if ctlc:
|
||||
do_ctlc(child)
|
||||
|
||||
# continue again to catch 2nd name error from
|
||||
# continue again to catch 2nd name error from
|
||||
# actor 'name_error_1' (which is 2nd depth).
|
||||
child.sendline('c')
|
||||
|
@ -617,31 +622,38 @@ def test_multi_subactors_root_errors(
|
|||
except TIMEOUT:
|
||||
child.sendline('')
|
||||
|
||||
before = str(child.before.decode())
|
||||
assert "Attaching to pdb in crashed actor: ('name_error_1'" in before
|
||||
assert "NameError" in before
|
||||
# XXX: lol honestly no idea why CI is cuck but
|
||||
# seems like this likely falls into our unhandled nested
|
||||
# case and isn't working in that env due to raciness..
|
||||
name = 'name_error' if ctlc else 'name_error_1'
|
||||
assert_before(child, [
|
||||
f"Attaching to pdb in crashed actor: ('{name}'",
|
||||
"NameError",
|
||||
])
|
||||
|
||||
if ctlc:
|
||||
do_ctlc(child)
|
||||
|
||||
child.sendline('c')
|
||||
child.expect(r"\(Pdb\+\+\)")
|
||||
before = str(child.before.decode())
|
||||
assert "Attaching to pdb in crashed actor: ('spawn_error'" in before
|
||||
# boxed error from previous step
|
||||
assert "RemoteActorError: ('name_error_1'" in before
|
||||
assert "NameError" in before
|
||||
assert_before(child, [
|
||||
"Attaching to pdb in crashed actor: ('spawn_error'",
|
||||
# boxed error from previous step
|
||||
"RemoteActorError: ('name_error_1'",
|
||||
"NameError",
|
||||
])
|
||||
|
||||
if ctlc:
|
||||
do_ctlc(child)
|
||||
|
||||
child.sendline('c')
|
||||
child.expect(r"\(Pdb\+\+\)")
|
||||
before = str(child.before.decode())
|
||||
assert "Attaching to pdb in crashed actor: ('root'" in before
|
||||
# boxed error from first level failure
|
||||
assert "RemoteActorError: ('name_error'" in before
|
||||
assert "NameError" in before
|
||||
assert_before(child, [
|
||||
"Attaching to pdb in crashed actor: ('root'",
|
||||
# boxed error from previous step
|
||||
"RemoteActorError: ('name_error'",
|
||||
"NameError",
|
||||
])
|
||||
|
||||
# warnings assert we probably don't need
|
||||
# assert "Cancelling nursery in ('spawn_error'," in before
|
||||
|
|
Loading…
Reference in New Issue