Tweak timeouts and rm `arbiter_addr` in tests
Use `cpu_scaling_factor()` headroom in `test_peer_spawns_and_cancels_service_subactor`'s `fail_after` to avoid flaky timeouts on throttled CI runners. Rename `arbiter_addr=` -> `registry_addrs=[..]` throughout `test_spawning` and `test_task_broadcasting` suites to match the current `open_root_actor()` / `open_nursery()` API. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codesubint_spawner_backend
parent
490fac432c
commit
f881683c97
|
|
@ -24,6 +24,8 @@ from tractor._testing import (
|
||||||
expect_ctxc,
|
expect_ctxc,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from .conftest import cpu_scaling_factor
|
||||||
|
|
||||||
# XXX TODO cases:
|
# XXX TODO cases:
|
||||||
# - [x] WE cancelled the peer and thus should not see any raised
|
# - [x] WE cancelled the peer and thus should not see any raised
|
||||||
# `ContextCancelled` as it should be reaped silently?
|
# `ContextCancelled` as it should be reaped silently?
|
||||||
|
|
@ -1030,6 +1032,7 @@ def test_peer_spawns_and_cancels_service_subactor(
|
||||||
reg_addr: tuple[str, int],
|
reg_addr: tuple[str, int],
|
||||||
raise_sub_spawn_error_after: float|None,
|
raise_sub_spawn_error_after: float|None,
|
||||||
loglevel: str,
|
loglevel: str,
|
||||||
|
test_log: tractor.log.StackLevelAdapter,
|
||||||
# ^XXX, set to 'warning' to see masked-exc warnings
|
# ^XXX, set to 'warning' to see masked-exc warnings
|
||||||
# that may transpire during actor-nursery teardown.
|
# that may transpire during actor-nursery teardown.
|
||||||
):
|
):
|
||||||
|
|
@ -1250,9 +1253,20 @@ def test_peer_spawns_and_cancels_service_subactor(
|
||||||
|
|
||||||
# assert spawn_ctx.cancelled_caught
|
# assert spawn_ctx.cancelled_caught
|
||||||
|
|
||||||
|
|
||||||
async def _main():
|
async def _main():
|
||||||
|
headroom: float = cpu_scaling_factor()
|
||||||
|
this_fast_on_linux: float = 3
|
||||||
|
this_fast = this_fast_on_linux * headroom
|
||||||
|
if headroom != 1.:
|
||||||
|
test_log.warning(
|
||||||
|
f'Adding latency headroom on linux bc CPU scaling,\n'
|
||||||
|
f'headroom: {headroom}\n'
|
||||||
|
f'this_fast_on_linux: {this_fast_on_linux} -> {this_fast}\n'
|
||||||
|
)
|
||||||
with trio.fail_after(
|
with trio.fail_after(
|
||||||
3 if not debug_mode
|
this_fast
|
||||||
|
if not debug_mode
|
||||||
else 999
|
else 999
|
||||||
):
|
):
|
||||||
await main()
|
await main()
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ async def spawn(
|
||||||
assert actor is None # no runtime yet
|
assert actor is None # no runtime yet
|
||||||
async with (
|
async with (
|
||||||
tractor.open_root_actor(
|
tractor.open_root_actor(
|
||||||
arbiter_addr=reg_addr,
|
registry_addrs=[reg_addr],
|
||||||
),
|
),
|
||||||
tractor.open_nursery() as an,
|
tractor.open_nursery() as an,
|
||||||
):
|
):
|
||||||
|
|
@ -203,7 +203,7 @@ def test_loglevel_propagated_to_subactor(
|
||||||
async with tractor.open_nursery(
|
async with tractor.open_nursery(
|
||||||
name='registrar',
|
name='registrar',
|
||||||
start_method=start_method,
|
start_method=start_method,
|
||||||
arbiter_addr=reg_addr,
|
registry_addrs=[reg_addr],
|
||||||
|
|
||||||
) as tn:
|
) as tn:
|
||||||
await tn.run_in_actor(
|
await tn.run_in_actor(
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ async def open_sequence_streamer(
|
||||||
) -> tractor.MsgStream:
|
) -> tractor.MsgStream:
|
||||||
|
|
||||||
async with tractor.open_nursery(
|
async with tractor.open_nursery(
|
||||||
arbiter_addr=reg_addr,
|
registry_addrs=[reg_addr],
|
||||||
start_method=start_method,
|
start_method=start_method,
|
||||||
) as an:
|
) as an:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue