Use `assert_before` more extensively

signint_saviour
Tyler Goodlet 2022-07-29 19:34:54 -04:00
parent 87b2ccb86a
commit 8896ba2bf8
1 changed files with 49 additions and 41 deletions

View File

@ -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
@ -423,10 +424,6 @@ def test_multi_subactors(
"NameError",
])
# before = str(child.before.decode())
# assert "Attaching to pdb in crashed actor: ('name_error_1'" in before
# assert "NameError" in before
if ctlc:
do_ctlc(child)
@ -455,11 +452,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 +468,17 @@ def test_multi_subactors(
child.expect(r"\(Pdb\+\+\)")
before = str(child.before.decode())
assert_before(child, [
# debugger attaches to root
assert "Attaching to pdb in crashed actor: ('root'" in before
"Attaching to pdb in crashed actor: ('root'",
# 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
"RemoteActorError: ('breakpoint_forever'",
"RemoteActorError: ('name_error'",
"RemoteActorError: ('spawn_error'",
"RemoteActorError: ('name_error_1'",
'bdb.BdbQuit',
])
if ctlc:
do_ctlc(child)
@ -486,13 +486,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 +610,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 +618,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
assert_before(child, [
"Attaching to pdb in crashed actor: ('spawn_error'",
# boxed error from previous step
assert "RemoteActorError: ('name_error_1'" in before
assert "NameError" in before
"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