Skip to content

Commit 43a9eb0

Browse files
committed
address comments
1 parent 35154c3 commit 43a9eb0

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

tests/smoketests/sdk/test_async_devbox.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,23 @@ async def test_shell_exec_async_with_both_streams(self, devbox: AsyncDevbox) ->
10411041
class TestAsyncDevboxLogs:
10421042
"""Test async devbox logs retrieval functionality."""
10431043

1044+
@pytest.mark.timeout(THIRTY_SECOND_TIMEOUT)
1045+
async def test_logs_basic(self, shared_devbox: AsyncDevbox) -> None:
1046+
"""Test retrieving unfiltered devbox logs."""
1047+
test_message = "async basic log test message"
1048+
result = await shared_devbox.cmd.exec(f'echo "{test_message}"')
1049+
assert result.exit_code == 0
1050+
1051+
# Log ingestion is async — logs may not be queryable immediately after
1052+
# command execution. Poll every 1s with a 10s timeout (well within the
1053+
# 30s test timeout) to accommodate variable ingestion latency.
1054+
logs = await async_poll_until(
1055+
retriever=lambda: shared_devbox.logs(),
1056+
is_terminal=lambda l: any(test_message in (log.message or "") for log in l.logs),
1057+
config=PollingConfig(timeout_seconds=10, interval_seconds=1),
1058+
)
1059+
assert any(test_message in (log.message or "") for log in logs.logs)
1060+
10441061
@pytest.mark.timeout(THIRTY_SECOND_TIMEOUT)
10451062
async def test_logs_with_execution_filter(self, shared_devbox: AsyncDevbox) -> None:
10461063
"""Test retrieving devbox logs filtered by execution ID."""

tests/smoketests/sdk/test_devbox.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,23 @@ def test_shell_exec_async_with_both_streams(self, devbox: Devbox) -> None:
10261026
class TestDevboxLogs:
10271027
"""Test devbox logs retrieval functionality."""
10281028

1029+
@pytest.mark.timeout(THIRTY_SECOND_TIMEOUT)
1030+
def test_logs_basic(self, shared_devbox: Devbox) -> None:
1031+
"""Test retrieving unfiltered devbox logs."""
1032+
test_message = "basic log test message"
1033+
result = shared_devbox.cmd.exec(f'echo "{test_message}"')
1034+
assert result.exit_code == 0
1035+
1036+
# Log ingestion is async — logs may not be queryable immediately after
1037+
# command execution. Poll every 1s with a 10s timeout (well within the
1038+
# 30s test timeout) to accommodate variable ingestion latency.
1039+
logs = poll_until(
1040+
retriever=lambda: shared_devbox.logs(),
1041+
is_terminal=lambda l: any(test_message in (log.message or "") for log in l.logs),
1042+
config=PollingConfig(timeout_seconds=10, interval_seconds=1),
1043+
)
1044+
assert any(test_message in (log.message or "") for log in logs.logs)
1045+
10291046
@pytest.mark.timeout(THIRTY_SECOND_TIMEOUT)
10301047
def test_logs_with_execution_filter(self, shared_devbox: Devbox) -> None:
10311048
"""Test retrieving devbox logs filtered by execution ID."""

0 commit comments

Comments
 (0)