@@ -458,6 +458,53 @@ async def test_create_and_remove_tunnel(self, async_sdk_client: AsyncRunloopSDK)
458458 finally :
459459 await devbox .shutdown ()
460460
461+ @pytest .mark .timeout (TWO_MINUTE_TIMEOUT )
462+ async def test_create_with_tunnel_param (self , async_sdk_client : AsyncRunloopSDK ) -> None :
463+ """Test creating a devbox with tunnel configuration in create params."""
464+ devbox = await async_sdk_client .devbox .create (
465+ name = unique_name ("sdk-async-devbox-tunnel-param" ),
466+ launch_parameters = {"resource_size_request" : "SMALL" , "keep_alive_time_seconds" : 60 * 5 },
467+ tunnel = {"auth_mode" : "open" },
468+ )
469+
470+ try :
471+ # Verify devbox is running
472+ info = await devbox .get_info ()
473+ assert info .status == "running"
474+
475+ # Verify tunnel was created at launch
476+ assert info .tunnel is not None
477+ assert info .tunnel .tunnel_key is not None
478+ assert info .tunnel .auth_mode is not None
479+ finally :
480+ await devbox .shutdown ()
481+
482+ @pytest .mark .timeout (TWO_MINUTE_TIMEOUT )
483+ async def test_enable_tunnel (self , async_sdk_client : AsyncRunloopSDK ) -> None :
484+ """Test enabling a V2 tunnel on an existing devbox."""
485+ devbox = await async_sdk_client .devbox .create (
486+ name = unique_name ("sdk-async-devbox-enable-tunnel" ),
487+ launch_parameters = {"resource_size_request" : "SMALL" , "keep_alive_time_seconds" : 60 * 5 },
488+ )
489+
490+ try :
491+ # Verify no tunnel exists initially
492+ info = await devbox .get_info ()
493+ assert info .tunnel is None
494+
495+ # Enable tunnel using the V2 API via SDK
496+ tunnel = await devbox .net .enable_tunnel (auth_mode = "open" )
497+ assert tunnel is not None
498+ assert tunnel .tunnel_key is not None
499+ assert tunnel .auth_mode is not None
500+
501+ # Verify tunnel is now present in devbox info
502+ info = await devbox .get_info ()
503+ assert info .tunnel is not None
504+ assert info .tunnel .tunnel_key == tunnel .tunnel_key
505+ finally :
506+ await devbox .shutdown ()
507+
461508
462509class TestAsyncDevboxCreationMethods :
463510 """Test various async devbox creation methods."""
0 commit comments