Local Simulation And Testing
Last reviewed: 2026-07-05
Simulation Surfaces
The repository treats the simulator as first-class worker behavior, not throwaway test code.
| Surface | Status | Source |
|---|---|---|
| In-process fake client | Implemented | src/anuva_python_server/simulator/fake_client.py |
| HTTP simulator server | Implemented | src/anuva_python_server/simulator/app.py |
| In-memory state machine | Implemented | src/anuva_python_server/simulator/state.py |
| Built-in scenarios | Partial | src/anuva_python_server/simulator/scenarios.py |
| Disk scenario loading | Implemented | JSON/YAML under simulator.data_dir/scenarios/<name> |
| Dashboard simulator controls | Partial | src/anuva_python_server/servers/dashboard.py |
Built-In Scenarios
| Scenario | Status | Purpose |
|---|---|---|
happy_path_final_render |
Implemented | One queued final render job with placeholder asset. |
claim_conflict |
Implemented | Claim endpoint returns conflict after simulating another worker claim. |
asset_download_failure |
Implemented | Required asset path is missing. |
unity_render_failure |
Partial | Scenario exists; actual Unity failure is emitted by fake Unity/tests, not simulator HTTP state alone. |
upload_failure |
Implemented | Upload endpoint fails and moves job to uploadFailed. |
cancellation |
Partial | Cancel-on-claim scenario exists. |
web_app_unavailable |
Implemented | Simulator returns unavailable behavior. |
Known gap: required scenarios from the requirements doc such as happy path preview, manual-claim multi-job, invalid job package, cancellation during render, and signed upload simulation are not all present as built-in scenarios.
Local Commands
Typical simulator command:
.\.venv\Scripts\python.exe -m anuva_python_server.cli simulator run --scenario happy_path_final_render
Other simulator commands:
.\.venv\Scripts\python.exe -m anuva_python_server.cli simulator list-scenarios
.\.venv\Scripts\python.exe -m anuva_python_server.cli simulator reset
.\.venv\Scripts\python.exe -m anuva_python_server.cli simulator load-scenario happy_path_final_render
Manual launcher scripts exist for simulator plus Unity Editor or EXE flows:
Testing Unity Communication Without The Full Web App
tests/integration/test_unity_zmq_client.py provides a fake Unity server that binds the command REP socket and connects PUSH sockets to Python's status/heartbeat ports. It verifies render.start, progress/completion/failure events, message logging, timeouts, and helper commands.
The full job lifecycle can also be tested without the real Web App by combining:
- Simulator or
FakeWebAppClient. - Content server.
- Fake Unity client/server from tests or Unity Editor Play Mode.
JobRunner.manual_claim_render_job()or dashboard run routes.
Source Files To Inspect
src/anuva_python_server/simulator/src/anuva_python_server/servers/dashboard.pytests/unit/test_simulator.pytests/integration/test_simulator_app.pytests/integration/test_unity_zmq_client.pytests/unit/test_output_and_completion.pydocs/User_Guide.mddocs/Operations.md
State map: TestMap, ScriptsAndCommands.