Skip to content

fix: correct precendence at client connect #801

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

Draft
wants to merge 6 commits 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
2 changes: 1 addition & 1 deletion client/gefyra/api/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def connect( # noqa: C901
cargo_endpoint_host=gclient_conf.gefyra_server.split(":")[0],
cargo_endpoint_port=gclient_conf.gefyra_server.split(":")[1],
cargo_container_name=f"gefyra-cargo-{connection_name}",
wireguard_mtu=gclient_conf.wireguard_mtu or (str(mtu) if mtu else None),
wireguard_mtu=(str(mtu) if mtu else None) or gclient_conf.wireguard_mtu,
)

gclient = handle_get_gefyraclient(config, gclient_conf.client_id)
Expand Down
34 changes: 34 additions & 0 deletions client/tests/e2e/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,3 +1135,37 @@ def test_util_for_pod_not_found(self):
config=default_configuration, name="foo", namespace="default"
)
self.assertIn("Pod foo not found.", str(rte.exception))

def test_v_client_connect_params_precedence(self):
runner = CliRunner()
self.gefyra_up()
self.assert_gefyra_client_state(
client_id=CONNECTION_NAME, state=GefyraClientState.ACTIVE
)

c_file = write_client_file(
client_id=CONNECTION_NAME,
host="127.0.0.1",
)

file_loc = os.path.join(
get_gefyra_config_location(),
f"{CONNECTION_NAME}_client.json",
)
fh = open(file_loc, "w+")
fh.write(c_file)
fh.seek(0)
fh.close()
sleep(10)
res = runner.invoke(
cli,
["connections", "connect", "-n", CONNECTION_NAME, "--mtu", "1200"],
catch_exceptions=False,
)
self.assertEqual(res.exit_code, 0)

clients = list_client()

applied_config = clients[0].get_client_config(gefyra_server="127.0.0.1:31820")

self.assertEqual(applied_config.WIREGUARD_MTU, "1200")
Loading