Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLT-5607] Reduce derp warning logs test #973

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading