-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[syft/network] network service
add_route
now takes peer's verify key
instead of the whole NodePeer object Co-authored-by: Shubham Gupta <[email protected]>
- Loading branch information
1 parent
78a3ac5
commit 93d7d53
Showing
2 changed files
with
18 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,7 +354,7 @@ def test_add_route(set_env_var, gateway_port: int, domain_1_port: int) -> None: | |
new_route = HTTPNodeRoute(host_or_ip="localhost", port=10000) | ||
domain_peer: NodePeer = gateway_client.api.services.network.get_all_peers()[0] | ||
res = gateway_client.api.services.network.add_route( | ||
peer=domain_peer, route=new_route | ||
peer_verify_key=domain_peer.verify_key, route=new_route | ||
) | ||
assert isinstance(res, SyftSuccess) | ||
domain_peer = gateway_client.api.services.network.get_all_peers()[0] | ||
|
@@ -364,7 +364,7 @@ def test_add_route(set_env_var, gateway_port: int, domain_1_port: int) -> None: | |
# adding another route to the domain | ||
new_route2 = HTTPNodeRoute(host_or_ip="localhost", port=10001) | ||
res = gateway_client.api.services.network.add_route( | ||
peer=domain_peer, route=new_route2 | ||
peer_verify_key=domain_peer.verify_key, route=new_route2 | ||
) | ||
assert isinstance(res, SyftSuccess) | ||
domain_peer = gateway_client.api.services.network.get_all_peers()[0] | ||
|
@@ -374,7 +374,7 @@ def test_add_route(set_env_var, gateway_port: int, domain_1_port: int) -> None: | |
|
||
# add an existed route to the domain and check its priority gets updated | ||
res = gateway_client.api.services.network.add_route( | ||
peer=domain_peer, route=domain_peer.node_routes[0] | ||
peer_verify_key=domain_peer.verify_key, route=domain_peer.node_routes[0] | ||
) | ||
assert "route already exists" in res.message | ||
assert isinstance(res, SyftSuccess) | ||
|
@@ -389,7 +389,7 @@ def test_add_route(set_env_var, gateway_port: int, domain_1_port: int) -> None: | |
|
||
# add another existed route (port 10000) | ||
res = gateway_client.api.services.network.add_route( | ||
peer=domain_peer, route=domain_peer.node_routes[1] | ||
peer_verify_key=domain_peer.verify_key, route=domain_peer.node_routes[1] | ||
) | ||
assert "route already exists" in res.message | ||
assert isinstance(res, SyftSuccess) | ||
|
@@ -430,7 +430,7 @@ def test_delete_route(set_env_var, gateway_port: int, domain_1_port: int) -> Non | |
new_route = HTTPNodeRoute(host_or_ip="localhost", port=10000) | ||
domain_peer: NodePeer = gateway_client.api.services.network.get_all_peers()[0] | ||
res = gateway_client.api.services.network.add_route( | ||
peer=domain_peer, route=new_route | ||
peer_verify_key=domain_peer.verify_key, route=new_route | ||
) | ||
assert isinstance(res, SyftSuccess) | ||
domain_peer = gateway_client.api.services.network.get_all_peers()[0] | ||
|
@@ -467,6 +467,10 @@ def test_add_route_on_peer(set_env_var, gateway_port: int, domain_1_port: int) - | |
port=domain_1_port, email="[email protected]", password="changethis" | ||
) | ||
|
||
# Remove existing peers | ||
assert isinstance(_remove_existing_peers(domain_client), SyftSuccess) | ||
assert isinstance(_remove_existing_peers(gateway_client), SyftSuccess) | ||
|
||
# connecting the domain to the gateway | ||
result = domain_client.connect_to_gateway(gateway_client) | ||
assert isinstance(result, SyftSuccess) | ||
|
@@ -612,11 +616,11 @@ def test_update_route_priority( | |
new_route2 = HTTPNodeRoute(host_or_ip="localhost", port=10001) | ||
domain_peer: NodePeer = gateway_client.api.services.network.get_all_peers()[0] | ||
res = gateway_client.api.services.network.add_route( | ||
peer=domain_peer, route=new_route | ||
peer_verify_key=domain_peer.verify_key, route=new_route | ||
) | ||
assert isinstance(res, SyftSuccess) | ||
res = gateway_client.api.services.network.add_route( | ||
peer=domain_peer, route=new_route2 | ||
peer_verify_key=domain_peer.verify_key, route=new_route2 | ||
) | ||
assert isinstance(res, SyftSuccess) | ||
|
||
|