Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 75b268f

Browse files
committedApr 16, 2025·
tests
1 parent aa39aa5 commit 75b268f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
 

‎tests/custom/test_client.py

+31
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,43 @@ def test_upload_download() -> None:
282282
ubuntu_instance.stop()
283283

284284

285+
def test_beta_vm_management() -> None:
286+
_check_api_key()
287+
client = Scrapybara()
288+
289+
# Start an rodent instance
290+
instance = client.start_ubuntu(backend="rodent")
291+
assert instance.id is not None
292+
293+
try:
294+
# Take a snapshot
295+
snapshot_response = client.beta_vm_management.take_snapshot(instance_id=instance.id)
296+
assert snapshot_response is not None
297+
assert snapshot_response.snapshot_id is not None
298+
snapshot_id = snapshot_response.snapshot_id
299+
print(f"Created snapshot with ID: {snapshot_id}")
300+
301+
# Warmup the snapshot
302+
warmup_response = client.beta_vm_management.warmup_snapshot(snapshot_id=snapshot_id)
303+
assert warmup_response is not None
304+
assert warmup_response.success is True
305+
306+
# Delete the snapshot
307+
delete_response = client.beta_vm_management.delete_snapshot(snapshot_id=snapshot_id)
308+
assert delete_response is not None
309+
assert delete_response.success is True
310+
311+
finally:
312+
instance.stop()
313+
314+
285315
if __name__ == "__main__":
286316
test_ubuntu()
287317
test_browser()
288318
test_ubuntu_openai()
289319
test_browser_openai()
290320
test_upload_download()
321+
test_beta_vm_management()
291322
# test_ubuntu_thinking()
292323
# test_browser_thinking()
293324
# test_windows()

0 commit comments

Comments
 (0)
Please sign in to comment.