Skip to content

Commit 92004cc

Browse files
alb-rlcursoragent
andauthored
Python client tunnel smoketest (#750)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: albert <alb-rl@users.noreply.github.com>
1 parent d2b32e9 commit 92004cc

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

tests/smoketests/sdk/test_async_devbox.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,25 +438,31 @@ async def test_create_ssh_key(self, async_sdk_client: AsyncRunloopSDK) -> None:
438438
await devbox.shutdown()
439439

440440
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
441-
async def test_create_and_remove_tunnel(self, async_sdk_client: AsyncRunloopSDK) -> None:
442-
"""Test creating and removing a tunnel."""
441+
async def test_create_tunnel_deprecated(self, async_sdk_client: AsyncRunloopSDK) -> None:
442+
"""Test creating a tunnel (deprecated - now creates v2 tunnel).
443+
444+
Note: The deprecated create_tunnel endpoint now creates v2 Portal tunnels
445+
which cannot be removed. They remain active until the devbox is stopped.
446+
Use enable_tunnel for creating v2 tunnels instead.
447+
"""
443448
devbox = await async_sdk_client.devbox.create(
444449
name=unique_name("sdk-async-devbox-tunnel"),
445450
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
446451
)
447452

448453
try:
449-
# Create tunnel
454+
# Create tunnel (now creates v2 Portal tunnel)
450455
with pytest.warns(DeprecationWarning, match="create_tunnel is deprecated"):
451456
tunnel = await devbox.net.create_tunnel(port=8080)
452457
assert tunnel is not None
453458
assert tunnel.url is not None
454459
assert tunnel.port == 8080
455460
assert tunnel.devbox_id == devbox.id
456461

457-
# Remove tunnel
458-
with pytest.warns(DeprecationWarning, match="remove_tunnel is deprecated"):
459-
await devbox.net.remove_tunnel(port=8080)
462+
# Verify tunnel persists in devbox info (v2 tunnels cannot be removed)
463+
info = await devbox.get_info()
464+
assert info.tunnel is not None
465+
assert info.tunnel.tunnel_key is not None
460466
finally:
461467
await devbox.shutdown()
462468

tests/smoketests/sdk/test_devbox.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,25 +435,31 @@ def test_create_ssh_key(self, sdk_client: RunloopSDK) -> None:
435435
devbox.shutdown()
436436

437437
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
438-
def test_create_and_remove_tunnel(self, sdk_client: RunloopSDK) -> None:
439-
"""Test creating and removing a tunnel."""
438+
def test_create_tunnel_deprecated(self, sdk_client: RunloopSDK) -> None:
439+
"""Test creating a tunnel (deprecated - now creates v2 tunnel).
440+
441+
Note: The deprecated create_tunnel endpoint now creates v2 Portal tunnels
442+
which cannot be removed. They remain active until the devbox is stopped.
443+
Use enable_tunnel for creating v2 tunnels instead.
444+
"""
440445
devbox = sdk_client.devbox.create(
441446
name=unique_name("sdk-devbox-tunnel"),
442447
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
443448
)
444449

445450
try:
446-
# Create tunnel
451+
# Create tunnel (now creates v2 Portal tunnel)
447452
with pytest.warns(DeprecationWarning, match="create_tunnel is deprecated"):
448453
tunnel = devbox.net.create_tunnel(port=8080)
449454
assert tunnel is not None
450455
assert tunnel.url is not None
451456
assert tunnel.port == 8080
452457
assert tunnel.devbox_id == devbox.id
453458

454-
# Remove tunnel
455-
with pytest.warns(DeprecationWarning, match="remove_tunnel is deprecated"):
456-
devbox.net.remove_tunnel(port=8080)
459+
# Verify tunnel persists in devbox info (v2 tunnels cannot be removed)
460+
info = devbox.get_info()
461+
assert info.tunnel is not None
462+
assert info.tunnel.tunnel_key is not None
457463
finally:
458464
devbox.shutdown()
459465

0 commit comments

Comments
 (0)