diff --git a/nat-lab/tests/test_batching.py b/nat-lab/tests/test_batching.py index 54dfd0ba1..5925be345 100644 --- a/nat-lab/tests/test_batching.py +++ b/nat-lab/tests/test_batching.py @@ -293,49 +293,49 @@ def features(): ] -# @pytest.mark.asyncio -# @pytest.mark.parametrize( -# "setup_params", -# [ -# proxying_peer_parameters( -# [ConnectionTag.DOCKER_CONE_CLIENT_1, -# ConnectionTag.DOCKER_CONE_CLIENT_2] -# ) -# ], -# ) -# async def test_proxying_peer_batched_keepalive( -# setup_params: List[SetupParameters], -# ) -> None: -# # Since batching keepalives are performed on application level instead of Wireguard -# # backend we need to ensure that proxying peers are receiving the keepalives. To test -# # for that we can enable link detection that guarantees quick detection if there's no corresponding -# # received traffic(WireGuard PassiveKeepalive). If batcher correctly emits pings, it -# # should trigger link detection quite quickly. -# async with AsyncExitStack() as exit_stack: -# env = await setup_mesh_nodes(exit_stack, setup_params) -# -# await asyncio.gather(*[ -# await exit_stack.enter_async_context( -# run_async_context( -# client.wait_for_state_peer( -# node.public_key, [NodeState.CONNECTED], [ -# PathType.RELAY] -# ) -# ) -# ) -# for client, node in itertools.product(env.clients, env.nodes) -# if not client.is_node(node) -# ]) -# -# alpha, beta = env.clients -# await beta.stop_device() -# -# _, beta_node = env.nodes -# -# await alpha.wait_for_state_peer( -# beta_node.public_key, -# [NodeState.CONNECTED], -# [PathType.RELAY], -# timeout=30, -# link_state=LinkState.DOWN, -# ) +@pytest.mark.asyncio +@pytest.mark.parametrize( + "setup_params", + [ + proxying_peer_parameters( + [ConnectionTag.DOCKER_CONE_CLIENT_1, + ConnectionTag.DOCKER_CONE_CLIENT_2] + ) + ], +) +async def test_proxying_peer_batched_keepalive( + setup_params: List[SetupParameters], +) -> None: + # Since batching keepalives are performed on application level instead of Wireguard + # backend we need to ensure that proxying peers are receiving the keepalives. To test + # for that we can enable link detection that guarantees quick detection if there's no corresponding + # received traffic(WireGuard PassiveKeepalive). If batcher correctly emits pings, it + # should trigger link detection quite quickly. + async with AsyncExitStack() as exit_stack: + env = await setup_mesh_nodes(exit_stack, setup_params) + + await asyncio.gather(*[ + await exit_stack.enter_async_context( + run_async_context( + client.wait_for_state_peer( + node.public_key, [NodeState.CONNECTED], [ + PathType.RELAY] + ) + ) + ) + for client, node in itertools.product(env.clients, env.nodes) + if not client.is_node(node) + ]) + + alpha, beta = env.clients + await beta.stop_device() + + _, beta_node = env.nodes + + await alpha.wait_for_state_peer( + beta_node.public_key, + [NodeState.CONNECTED], + [PathType.RELAY], + timeout=30, + link_state=LinkState.DOWN, + )