Skip to content

Commit

Permalink
restore derp tests
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Pukenis <[email protected]>
  • Loading branch information
LukasPukenis committed Dec 12, 2024
1 parent bc30a66 commit f62848b
Showing 1 changed file with 11 additions and 106 deletions.
117 changes: 11 additions & 106 deletions nat-lab/tests/test_derp_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from copy import deepcopy
from helpers import SetupParameters, setup_mesh_nodes
from typing import List
from utils.bindings import RelayState, FeatureBatching, default_features
from utils.bindings import RelayState
from utils.connection_util import ConnectionTag
from utils.ping import ping

Expand All @@ -15,46 +15,13 @@
DERP3_IP = str(DERP_TERTIARY.ipv4)


def generate_features(batching: bool):
features = default_features()
features.wireguard.persistent_keepalive.proxying = 10
features.batching = (
FeatureBatching(
# It is used for direct, stun, proxy, vpn peers so the name can be confusing.
# TODO: rename to a better name
direct_connection_threshold=5,
trigger_cooldown_duration=60,
trigger_effective_duration=10,
)
if batching
else None
)
return features


@pytest.mark.asyncio
@pytest.mark.parametrize(
"setup_params",
[
[
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1,
features=generate_features(batching=False),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2,
features=generate_features(batching=False),
),
],
[
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1,
features=generate_features(batching=True),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2,
features=generate_features(batching=True),
),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2),
],
],
)
Expand Down Expand Up @@ -116,32 +83,9 @@ async def test_derp_reconnect_2clients(setup_params: List[SetupParameters]) -> N
"setup_params",
[
[
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1,
features=generate_features(batching=False),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2,
features=generate_features(batching=False),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_SYMMETRIC_CLIENT_1,
features=generate_features(batching=False),
),
],
[
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1,
features=generate_features(batching=True),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2,
features=generate_features(batching=True),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_SYMMETRIC_CLIENT_1,
features=generate_features(batching=True),
),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2),
SetupParameters(connection_tag=ConnectionTag.DOCKER_SYMMETRIC_CLIENT_1),
],
],
)
Expand Down Expand Up @@ -280,32 +224,9 @@ async def test_derp_reconnect_3clients(setup_params: List[SetupParameters]) -> N
"setup_params",
[
[
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1,
features=generate_features(batching=False),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2,
features=generate_features(batching=False),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_SYMMETRIC_CLIENT_1,
features=generate_features(batching=False),
),
],
[
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1,
features=generate_features(batching=True),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2,
features=generate_features(batching=True),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_SYMMETRIC_CLIENT_1,
features=generate_features(batching=True),
),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2),
SetupParameters(connection_tag=ConnectionTag.DOCKER_SYMMETRIC_CLIENT_1),
],
],
)
Expand Down Expand Up @@ -488,24 +409,8 @@ async def test_derp_restart(setup_params: List[SetupParameters]) -> None:
"setup_params",
[
[
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1,
features=generate_features(batching=False),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2,
features=generate_features(batching=False),
),
],
[
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1,
features=generate_features(batching=True),
),
SetupParameters(
connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2,
features=generate_features(batching=True),
),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_1),
SetupParameters(connection_tag=ConnectionTag.DOCKER_CONE_CLIENT_2),
],
],
)
Expand Down

0 comments on commit f62848b

Please sign in to comment.