Skip to content
Merged
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
18 changes: 12 additions & 6 deletions tests/smoketests/sdk/test_async_devbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,25 +438,31 @@ async def test_create_ssh_key(self, async_sdk_client: AsyncRunloopSDK) -> None:
await devbox.shutdown()

@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
async def test_create_and_remove_tunnel(self, async_sdk_client: AsyncRunloopSDK) -> None:
"""Test creating and removing a tunnel."""
async def test_create_tunnel_deprecated(self, async_sdk_client: AsyncRunloopSDK) -> None:
"""Test creating a tunnel (deprecated - now creates v2 tunnel).

Note: The deprecated create_tunnel endpoint now creates v2 Portal tunnels
which cannot be removed. They remain active until the devbox is stopped.
Use enable_tunnel for creating v2 tunnels instead.
"""
devbox = await async_sdk_client.devbox.create(
name=unique_name("sdk-async-devbox-tunnel"),
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
)

try:
# Create tunnel
# Create tunnel (now creates v2 Portal tunnel)
with pytest.warns(DeprecationWarning, match="create_tunnel is deprecated"):
tunnel = await devbox.net.create_tunnel(port=8080)
assert tunnel is not None
assert tunnel.url is not None
assert tunnel.port == 8080
assert tunnel.devbox_id == devbox.id

# Remove tunnel
with pytest.warns(DeprecationWarning, match="remove_tunnel is deprecated"):
await devbox.net.remove_tunnel(port=8080)
# Verify tunnel persists in devbox info (v2 tunnels cannot be removed)
info = await devbox.get_info()
assert info.tunnel is not None
assert info.tunnel.tunnel_key is not None
finally:
await devbox.shutdown()

Expand Down
18 changes: 12 additions & 6 deletions tests/smoketests/sdk/test_devbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,25 +435,31 @@ def test_create_ssh_key(self, sdk_client: RunloopSDK) -> None:
devbox.shutdown()

@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
def test_create_and_remove_tunnel(self, sdk_client: RunloopSDK) -> None:
"""Test creating and removing a tunnel."""
def test_create_tunnel_deprecated(self, sdk_client: RunloopSDK) -> None:
"""Test creating a tunnel (deprecated - now creates v2 tunnel).

Note: The deprecated create_tunnel endpoint now creates v2 Portal tunnels
which cannot be removed. They remain active until the devbox is stopped.
Use enable_tunnel for creating v2 tunnels instead.
"""
devbox = sdk_client.devbox.create(
name=unique_name("sdk-devbox-tunnel"),
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
)

try:
# Create tunnel
# Create tunnel (now creates v2 Portal tunnel)
with pytest.warns(DeprecationWarning, match="create_tunnel is deprecated"):
tunnel = devbox.net.create_tunnel(port=8080)
assert tunnel is not None
assert tunnel.url is not None
assert tunnel.port == 8080
assert tunnel.devbox_id == devbox.id

# Remove tunnel
with pytest.warns(DeprecationWarning, match="remove_tunnel is deprecated"):
devbox.net.remove_tunnel(port=8080)
# Verify tunnel persists in devbox info (v2 tunnels cannot be removed)
info = devbox.get_info()
assert info.tunnel is not None
assert info.tunnel.tunnel_key is not None
finally:
devbox.shutdown()

Expand Down