Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(test): add logging to periodic Linux cloud VM test (#1423)
r33drichardse4b047a43ec3
diff --git a/.github/workflows/periodic-test-linux-cloud-vm.yml b/.github/workflows/periodic-test-linux-cloud-vm.ymlindex a60e4db35a..a9bd232fd9 100644--- a/.github/workflows/periodic-test-linux-cloud-vm.yml+++ b/.github/workflows/periodic-test-linux-cloud-vm.yml@@ -38,9 +38,10 @@ jobs:run: pip install cua pytest pytest-asyncio- name: Run test- run: python -m pytest examples/sandboxes/test_linux_cloud_vm.py+ run: python -m pytest examples/sandboxes/test_linux_cloud_vm.py -v -s --log-cli-level=INFOenv:CUA_API_KEY: ${{ secrets[matrix.secret_name] }}+ CUA_LOG_LEVEL: DEBUG- name: Alert Alertmanager on failureif: failure()diff --git a/examples/sandboxes/test_linux_cloud_vm.py b/examples/sandboxes/test_linux_cloud_vm.pyindex 5040fd68ac..286a9a28ed 100644--- a/examples/sandboxes/test_linux_cloud_vm.py+++ b/examples/sandboxes/test_linux_cloud_vm.py@@ -16,13 +16,21 @@ Contrast:from __future__ import annotationsimport asyncio+import loggingimport os+import timeimport pytestfrom cua_sandbox import Image, Sandboxpytestmark = pytest.mark.asyncio+logging.basicConfig(+ level=logging.INFO,+ format="%(asctime)s %(levelname)s %(name)s: %(message)s",+)+logger = logging.getLogger("test_linux_cloud_vm")+def _has_cua_api_key() -> bool:return bool(os.environ.get("CUA_API_KEY"))@@ -30,15 +38,47 @@ def _has_cua_api_key() -> bool:@pytest.mark.skipif(not _has_cua_api_key(), reason="CUA_API_KEY not set")async def test_linux_cloud_vm():+ t0 = time.monotonic()+ logger.info("Creating ephemeral Linux cloud VM (ubuntu 24.04, kind=vm)")+async with Sandbox.ephemeral(Image.linux("ubuntu", "24.04", kind="vm"),) as sb:+ provision_time = time.monotonic() - t0+ logger.info(+ "VM ready: name=%s, provisioned in %.1fs",+ getattr(sb, "name", "unknown"),+ provision_time,+ )++ # Log transport/endpoint info if available+ transport = getattr(sb, "_transport", None)+ if transport:+ base_url = getattr(getattr(transport, "_inner", None), "_base_url", None)+ logger.info("Transport base_url=%s", base_url)++ t1 = time.monotonic()result = await sb.shell.run("uname -s")- assert result.success- assert "Linux" in result.stdout-+ logger.info(+ "shell.run('uname -s'): success=%s, stdout=%r, took=%.1fs",+ result.success,+ result.stdout.strip(),+ time.monotonic() - t1,+ )+ assert result.success, f"uname failed: stderr={result.stderr}"+ assert "Linux" in result.stdout, f"Expected 'Linux' in stdout, got: {result.stdout!r}"++ t2 = time.monotonic()screenshot = await sb.screenshot()- assert screenshot[:4] == b"\x89PNG"+ logger.info(+ "screenshot: %d bytes, took=%.1fs",+ len(screenshot),+ time.monotonic() - t2,+ )+ assert screenshot[:4] == b"\x89PNG", f"Screenshot not PNG: first 4 bytes = {screenshot[:4]!r}"++ total_time = time.monotonic() - t0+ logger.info("Test passed in %.1fs (provision=%.1fs)", total_time, provision_time)async def main():