@@ -220,8 +220,7 @@ async def test_restore_devbox_from_snapshot(self, async_sdk_client: AsyncRunloop
220220
221221 try :
222222 # Create new devbox from snapshot
223- restored_devbox = await async_sdk_client .devbox .create_from_snapshot (
224- snapshot_id = snapshot .id ,
223+ restored_devbox = await snapshot .create_devbox (
225224 name = unique_name ("sdk-async-restored-devbox" ),
226225 launch_parameters = {"resource_size_request" : "SMALL" , "keep_alive_time_seconds" : 60 * 5 },
227226 )
@@ -242,60 +241,6 @@ async def test_restore_devbox_from_snapshot(self, async_sdk_client: AsyncRunloop
242241 finally :
243242 await source_devbox .shutdown ()
244243
245- @pytest .mark .timeout (FOUR_MINUTE_TIMEOUT )
246- async def test_multiple_devboxes_from_snapshot (self , async_sdk_client : AsyncRunloopSDK ) -> None :
247- """Test creating multiple devboxes from the same snapshot."""
248- # Create source devbox
249- source_devbox = await async_sdk_client .devbox .create (
250- name = unique_name ("sdk-async-source-multi" ),
251- launch_parameters = {"resource_size_request" : "SMALL" , "keep_alive_time_seconds" : 60 * 5 },
252- )
253-
254- try :
255- # Create content
256- await source_devbox .file .write (file_path = "/tmp/async_shared.txt" , contents = "Async shared content" )
257-
258- # Create snapshot
259- snapshot = await source_devbox .snapshot_disk (
260- name = unique_name ("sdk-async-snapshot-multi" ),
261- )
262-
263- try :
264- # Create first devbox from snapshot
265- devbox1 = await async_sdk_client .devbox .create_from_snapshot (
266- snapshot_id = snapshot .id ,
267- name = unique_name ("sdk-async-restored-1" ),
268- launch_parameters = {"resource_size_request" : "SMALL" , "keep_alive_time_seconds" : 60 * 5 },
269- )
270-
271- # Create second devbox from snapshot
272- devbox2 = await async_sdk_client .devbox .create_from_snapshot (
273- snapshot_id = snapshot .id ,
274- name = unique_name ("sdk-async-restored-2" ),
275- launch_parameters = {"resource_size_request" : "SMALL" , "keep_alive_time_seconds" : 60 * 5 },
276- )
277-
278- try :
279- # Both should be running
280- assert devbox1 .id != devbox2 .id
281- info1 = await devbox1 .get_info ()
282- info2 = await devbox2 .get_info ()
283- assert info1 .status == "running"
284- assert info2 .status == "running"
285-
286- # Both should have the snapshot content
287- content1 = await devbox1 .file .read (file_path = "/tmp/async_shared.txt" )
288- content2 = await devbox2 .file .read (file_path = "/tmp/async_shared.txt" )
289- assert content1 == "Async shared content"
290- assert content2 == "Async shared content"
291- finally :
292- await devbox1 .shutdown ()
293- await devbox2 .shutdown ()
294- finally :
295- await snapshot .delete ()
296- finally :
297- await source_devbox .shutdown ()
298-
299244
300245class TestAsyncSnapshotListing :
301246 """Test async snapshot listing and retrieval operations."""
@@ -365,53 +310,3 @@ async def test_list_snapshots_by_devbox(self, async_sdk_client: AsyncRunloopSDK)
365310 await snapshot .delete ()
366311 finally :
367312 await devbox .shutdown ()
368-
369-
370- class TestAsyncSnapshotEdgeCases :
371- """Test async snapshot edge cases and special scenarios."""
372-
373- @pytest .mark .timeout (FOUR_MINUTE_TIMEOUT )
374- async def test_snapshot_preserves_file_permissions (self , async_sdk_client : AsyncRunloopSDK ) -> None :
375- """Test that snapshot preserves file permissions."""
376- # Create devbox
377- devbox = await async_sdk_client .devbox .create (
378- name = unique_name ("sdk-async-devbox-permissions" ),
379- launch_parameters = {"resource_size_request" : "SMALL" , "keep_alive_time_seconds" : 60 * 5 },
380- )
381-
382- try :
383- # Create executable file
384- await devbox .file .write (file_path = "/tmp/test_async_exec.sh" , contents = "#!/bin/bash\n echo 'Hello'" )
385- await devbox .cmd .exec (command = "chmod +x /tmp/test_async_exec.sh" )
386-
387- # Verify it's executable
388- result = await devbox .cmd .exec (command = "test -x /tmp/test_async_exec.sh && echo 'executable'" )
389- stdout = await result .stdout (num_lines = 1 )
390- assert "executable" in stdout
391-
392- # Create snapshot
393- snapshot = await devbox .snapshot_disk (
394- name = unique_name ("sdk-async-snapshot-permissions" ),
395- )
396-
397- try :
398- # Restore from snapshot
399- restored_devbox = await async_sdk_client .devbox .create_from_snapshot (
400- snapshot_id = snapshot .id ,
401- name = unique_name ("sdk-async-restored-permissions" ),
402- launch_parameters = {"resource_size_request" : "SMALL" , "keep_alive_time_seconds" : 60 * 5 },
403- )
404-
405- try :
406- # Verify file is still executable
407- result = await restored_devbox .cmd .exec (
408- command = "test -x /tmp/test_async_exec.sh && echo 'still_executable'"
409- )
410- stdout = await result .stdout (num_lines = 1 )
411- assert "still_executable" in stdout
412- finally :
413- await restored_devbox .shutdown ()
414- finally :
415- await snapshot .delete ()
416- finally :
417- await devbox .shutdown ()
0 commit comments