Skip to content

Commit d24b3c5

Browse files
committed
remove unnecessary tests from blueprint and snapshot smoke tests
1 parent 2f568e6 commit d24b3c5

File tree

4 files changed

+4
-280
lines changed

4 files changed

+4
-280
lines changed

tests/smoketests/sdk/test_async_blueprint.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ async def test_create_devbox_from_blueprint(self, async_sdk_client: AsyncRunloop
221221

222222
try:
223223
# Create devbox from the blueprint
224-
devbox = await async_sdk_client.devbox.create_from_blueprint_id(
225-
blueprint_id=blueprint.id,
224+
devbox = await blueprint.create_devbox(
226225
name=unique_name("sdk-async-devbox-from-blueprint"),
227226
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
228227
)
@@ -244,42 +243,6 @@ async def test_create_devbox_from_blueprint(self, async_sdk_client: AsyncRunloop
244243
finally:
245244
await blueprint.delete()
246245

247-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT * 2)
248-
async def test_create_multiple_devboxes_from_blueprint(self, async_sdk_client: AsyncRunloopSDK) -> None:
249-
"""Test creating multiple devboxes from the same blueprint."""
250-
# Create a blueprint
251-
blueprint = await async_sdk_client.blueprint.create(
252-
name=unique_name("sdk-async-blueprint-multi-devbox"),
253-
dockerfile="FROM ubuntu:20.04\nRUN apt-get update && apt-get install -y curl",
254-
)
255-
256-
try:
257-
# Create first devbox
258-
devbox1 = await async_sdk_client.devbox.create_from_blueprint_id(
259-
blueprint_id=blueprint.id,
260-
name=unique_name("sdk-async-devbox-1"),
261-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
262-
)
263-
264-
# Create second devbox
265-
devbox2 = await async_sdk_client.devbox.create_from_blueprint_id(
266-
blueprint_id=blueprint.id,
267-
name=unique_name("sdk-async-devbox-2"),
268-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
269-
)
270-
271-
try:
272-
assert devbox1.id != devbox2.id
273-
info1 = await devbox1.get_info()
274-
info2 = await devbox2.get_info()
275-
assert info1.status == "running"
276-
assert info2.status == "running"
277-
finally:
278-
await devbox1.shutdown()
279-
await devbox2.shutdown()
280-
finally:
281-
await blueprint.delete()
282-
283246

284247
class TestAsyncBlueprintErrorHandling:
285248
"""Test async blueprint error handling scenarios."""

tests/smoketests/sdk/test_async_snapshot.py

Lines changed: 1 addition & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -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

300245
class 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\necho '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()

tests/smoketests/sdk/test_blueprint.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ def test_create_devbox_from_blueprint(self, sdk_client: RunloopSDK) -> None:
221221

222222
try:
223223
# Create devbox from the blueprint
224-
devbox = sdk_client.devbox.create_from_blueprint_id(
225-
blueprint_id=blueprint.id,
224+
devbox = blueprint.create_devbox(
226225
name=unique_name("sdk-devbox-from-blueprint"),
227226
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
228227
)
@@ -244,40 +243,6 @@ def test_create_devbox_from_blueprint(self, sdk_client: RunloopSDK) -> None:
244243
finally:
245244
blueprint.delete()
246245

247-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT * 2)
248-
def test_create_multiple_devboxes_from_blueprint(self, sdk_client: RunloopSDK) -> None:
249-
"""Test creating multiple devboxes from the same blueprint."""
250-
# Create a blueprint
251-
blueprint = sdk_client.blueprint.create(
252-
name=unique_name("sdk-blueprint-multi-devbox"),
253-
dockerfile="FROM ubuntu:20.04\nRUN apt-get update && apt-get install -y curl",
254-
)
255-
256-
try:
257-
# Create first devbox
258-
devbox1 = sdk_client.devbox.create_from_blueprint_id(
259-
blueprint_id=blueprint.id,
260-
name=unique_name("sdk-devbox-1"),
261-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
262-
)
263-
264-
# Create second devbox
265-
devbox2 = sdk_client.devbox.create_from_blueprint_id(
266-
blueprint_id=blueprint.id,
267-
name=unique_name("sdk-devbox-2"),
268-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
269-
)
270-
271-
try:
272-
assert devbox1.id != devbox2.id
273-
assert devbox1.get_info().status == "running"
274-
assert devbox2.get_info().status == "running"
275-
finally:
276-
devbox1.shutdown()
277-
devbox2.shutdown()
278-
finally:
279-
blueprint.delete()
280-
281246

282247
class TestBlueprintErrorHandling:
283248
"""Test blueprint error handling scenarios."""

tests/smoketests/sdk/test_snapshot.py

Lines changed: 1 addition & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ def test_restore_devbox_from_snapshot(self, sdk_client: RunloopSDK) -> None:
219219

220220
try:
221221
# Create new devbox from snapshot
222-
restored_devbox = sdk_client.devbox.create_from_snapshot(
223-
snapshot_id=snapshot.id,
222+
restored_devbox = snapshot.create_devbox(
224223
name=unique_name("sdk-restored-devbox"),
225224
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
226225
)
@@ -241,58 +240,6 @@ def test_restore_devbox_from_snapshot(self, sdk_client: RunloopSDK) -> None:
241240
finally:
242241
source_devbox.shutdown()
243242

244-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT * 2)
245-
def test_multiple_devboxes_from_snapshot(self, sdk_client: RunloopSDK) -> None:
246-
"""Test creating multiple devboxes from the same snapshot."""
247-
# Create source devbox
248-
source_devbox = sdk_client.devbox.create(
249-
name=unique_name("sdk-source-multi"),
250-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
251-
)
252-
253-
try:
254-
# Create content
255-
source_devbox.file.write(file_path="/tmp/shared.txt", contents="Shared content")
256-
257-
# Create snapshot
258-
snapshot = source_devbox.snapshot_disk(
259-
name=unique_name("sdk-snapshot-multi"),
260-
)
261-
262-
try:
263-
# Create first devbox from snapshot
264-
devbox1 = sdk_client.devbox.create_from_snapshot(
265-
snapshot_id=snapshot.id,
266-
name=unique_name("sdk-restored-1"),
267-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
268-
)
269-
270-
# Create second devbox from snapshot
271-
devbox2 = sdk_client.devbox.create_from_snapshot(
272-
snapshot_id=snapshot.id,
273-
name=unique_name("sdk-restored-2"),
274-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
275-
)
276-
277-
try:
278-
# Both should be running
279-
assert devbox1.id != devbox2.id
280-
assert devbox1.get_info().status == "running"
281-
assert devbox2.get_info().status == "running"
282-
283-
# Both should have the snapshot content
284-
content1 = devbox1.file.read(file_path="/tmp/shared.txt")
285-
content2 = devbox2.file.read(file_path="/tmp/shared.txt")
286-
assert content1 == "Shared content"
287-
assert content2 == "Shared content"
288-
finally:
289-
devbox1.shutdown()
290-
devbox2.shutdown()
291-
finally:
292-
snapshot.delete()
293-
finally:
294-
source_devbox.shutdown()
295-
296243

297244
class TestSnapshotListing:
298245
"""Test snapshot listing and retrieval operations."""
@@ -362,49 +309,3 @@ def test_list_snapshots_by_devbox(self, sdk_client: RunloopSDK) -> None:
362309
snapshot.delete()
363310
finally:
364311
devbox.shutdown()
365-
366-
367-
class TestSnapshotEdgeCases:
368-
"""Test snapshot edge cases and special scenarios."""
369-
370-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT * 2)
371-
def test_snapshot_preserves_file_permissions(self, sdk_client: RunloopSDK) -> None:
372-
"""Test that snapshot preserves file permissions."""
373-
# Create devbox
374-
devbox = sdk_client.devbox.create(
375-
name=unique_name("sdk-devbox-permissions"),
376-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
377-
)
378-
379-
try:
380-
# Create executable file
381-
devbox.file.write(file_path="/tmp/test_exec.sh", contents="#!/bin/bash\necho 'Hello'")
382-
devbox.cmd.exec(command="chmod +x /tmp/test_exec.sh")
383-
384-
# Verify it's executable
385-
result = devbox.cmd.exec(command="test -x /tmp/test_exec.sh && echo 'executable'")
386-
assert "executable" in result.stdout(num_lines=1)
387-
388-
# Create snapshot
389-
snapshot = devbox.snapshot_disk(
390-
name=unique_name("sdk-snapshot-permissions"),
391-
)
392-
393-
try:
394-
# Restore from snapshot
395-
restored_devbox = sdk_client.devbox.create_from_snapshot(
396-
snapshot_id=snapshot.id,
397-
name=unique_name("sdk-restored-permissions"),
398-
launch_parameters={"resource_size_request": "SMALL", "keep_alive_time_seconds": 60 * 5},
399-
)
400-
401-
try:
402-
# Verify file is still executable
403-
result = restored_devbox.cmd.exec(command="test -x /tmp/test_exec.sh && echo 'still_executable'")
404-
assert "still_executable" in result.stdout(num_lines=1)
405-
finally:
406-
restored_devbox.shutdown()
407-
finally:
408-
snapshot.delete()
409-
finally:
410-
devbox.shutdown()

0 commit comments

Comments
 (0)