Skip to content

Commit

Permalink
[LLT-5607] Reduce derp warning logs test
Browse files Browse the repository at this point in the history
  • Loading branch information
stalowyjez committed Nov 21, 2024
1 parent 71b3c60 commit 782ac09
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/telio-relay/src/derp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,16 @@ impl State {
break (server, conn);
}
Err(err) => {
telio_log_warn!("({}) Failed to connect: {}", Self::NAME, err);
if config.servers.current_server_num == config.servers.servers.len() {
telio_log_warn!(
"({}) Failed to connect to any of {} servers: {}",
Self::NAME,
config.servers.servers.len(),
err
);
} else if config.servers.current_server_num == 1 {
telio_log_warn!("({}) Failed to connect: {}", Self::NAME, err);
}
last_disconnection_reason = err.into();
continue;
}
Expand Down
38 changes: 38 additions & 0 deletions nat-lab/tests/test_derp_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,41 @@ async def test_derp_server_list_exhaustion(setup_params: List[SetupParameters])

# Ping peer to check if connection truly works
await ping(alpha_connection, beta.ip_addresses[0])


@pytest.mark.parametrize(
"setup_params",
[
[
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2, derp_servers=[DERP_PRIMARY, DERP_SECONDARY, DERP_TERTIARY]),
],
[
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1),
SetupParameters(connection_tag=ConnectionTag.WINDOWS_VM_1 , derp_servers=[DERP_PRIMARY, DERP_SECONDARY, DERP_TERTIARY]),
],
],
)
@pytest.mark.asyncio
async def test_derp_reasonable_amount_of_logs(setup_params):
async with AsyncExitStack() as exit_stack:
env = await setup_mesh_nodes(exit_stack, setup_params)
_, beta = env.nodes
alpha_connection, _ = [conn.connection for conn in env.connections]
_, beta_client = env.clients

await ping(alpha_connection, beta.ip_addresses[0])

# an iptables rule is placed in order to reject connections and
# send a TCP reset to the client BETA
await exit_stack.enter_async_context(
beta_client.get_router().break_tcp_conn_to_host(DERP1_IP)
)
await exit_stack.enter_async_context(
beta_client.get_router().break_tcp_conn_to_host(DERP2_IP)
)
await exit_stack.enter_async_context(
beta_client.get_router().break_tcp_conn_to_host(DERP3_IP)
)

await asyncio.sleep(120.0)

0 comments on commit 782ac09

Please sign in to comment.