Skip to content

test(sandbox): comprehensive test suite for docker_sandbox module (+69 tests) - #143

Open
manus-use wants to merge 1 commit into
mainfrom
test/docker-sandbox-suite
Open

test(sandbox): comprehensive test suite for docker_sandbox module (+69 tests)#143
manus-use wants to merge 1 commit into
mainfrom
test/docker-sandbox-suite

Conversation

@manus-use

Copy link
Copy Markdown
Owner

Summary

Comprehensive test suite for the manus_agent.sandbox.docker_sandbox module — 69 fully-mocked tests covering the entire DockerSandbox class.

What's tested

Area Tests Coverage
__init__ 4 Default params, custom params, name format, uniqueness
start() / _start_sync() 4 Image pull on miss, skip pull when exists, container params, async wrapper
stop() / _stop_sync() 4 Container removal, client close error handling, no-op when None, async wrapper
execute_code() 7 Python/JS/Bash routing, temp file cleanup (success + error), default timeout, not-running guard
execute_command() 5 Success, timeout message, kill fallback, kill exception suppression, None timeout
_execute_sync() 6 Normal output, None stdout/stderr/both, non-UTF-8 bytes, non-zero exit
_copy_to_container() 4 Tar creation, file contents, binary data, nested paths
_get_file_extension() 3 groups Known languages, case-insensitive, unknown→txt fallback
_get_execution_command() 7 python/js/bash/shell/sh commands, unknown→cat fallback, case-insensitive
Lifecycle / Integration 4 Full start→stop, double-stop safety, non-zero exit propagation, UUID naming
Edge cases 4 Empty code, Unicode, docker_retry usage, label correctness, None client

Key design choices

  • 100% mocked — no real Docker daemon required; tests run in CI without Docker
  • Async-aware — tests verify asyncio.run() + run_in_executor patterns work correctly
  • Tar archive verification — tests actually parse the generated tar to confirm file name, mode, and content
  • Error resilience — verifies graceful handling of TimeoutError, client.close() failures, None outputs

Test results

1227 passed, 3 deselected, 3 warnings in 25.70s

Baseline was 1158 tests; this adds 69 new tests with 0 failures.

Overlap check

Confirmed no overlap with existing open PRs:

None of these test sandbox/docker_sandbox.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant