mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
feat: 引入 Rust executor/gateway sidecar 及 Python 侧双后端适配
- 新增 Rust workspace crates: aether-contracts, aether-executor, aether-gateway - aether-executor: 支持 Unix Socket/TCP 双传输模式,处理同步/流式上游请求 - aether-gateway: 作为本地主入口代理,集成 /api/internal/gateway/resolve 认证预解析 - Python 侧新增 ExecutionPlan 契约和 RustExecutorClient,各 handler 支持 executor_backend=rust 时将可序列化请求转发给 Rust executor 执行 - 重构 dev.sh 支持 executor/gateway 进程编排与生命周期管理 - 新增 internal gateway 路由,提供 resolve/passthrough 端点 - handler 层(chat/cli/video/endpoint_checker 等)全面适配 Rust executor 回退逻辑 - pipeline 层支持 trusted auth context 跳过重复认证 - 新增 Rust CI workflow 及对应测试用例
This commit is contained in:
43
tests/unit/test_executor_config.py
Normal file
43
tests/unit/test_executor_config.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from src.config.settings import Config
|
||||
|
||||
|
||||
def test_executor_config_defaults_to_rust_and_unix_socket(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
for key in (
|
||||
"EXECUTOR_BACKEND",
|
||||
"EXECUTOR_TRANSPORT",
|
||||
"EXECUTOR_SOCKET_PATH",
|
||||
"EXECUTOR_BASE_URL",
|
||||
"EXECUTOR_REQUEST_TIMEOUT",
|
||||
"HTTP_REQUEST_TIMEOUT",
|
||||
):
|
||||
monkeypatch.delenv(key, raising=False)
|
||||
|
||||
cfg = Config()
|
||||
|
||||
assert cfg.executor_backend == "rust"
|
||||
assert cfg.executor_transport == "unix_socket"
|
||||
assert cfg.executor_socket_path == "/tmp/aether-executor.sock"
|
||||
assert cfg.executor_base_url == "http://127.0.0.1:5219"
|
||||
assert cfg.executor_request_timeout == cfg.http_request_timeout
|
||||
|
||||
|
||||
def test_executor_config_accepts_env_override(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setenv("EXECUTOR_BACKEND", "RUST")
|
||||
monkeypatch.setenv("EXECUTOR_TRANSPORT", "TCP")
|
||||
monkeypatch.setenv("EXECUTOR_SOCKET_PATH", "/var/run/aether.sock")
|
||||
monkeypatch.setenv("EXECUTOR_BASE_URL", "http://127.0.0.1:9311")
|
||||
monkeypatch.setenv("EXECUTOR_REQUEST_TIMEOUT", "12.5")
|
||||
|
||||
cfg = Config()
|
||||
|
||||
assert cfg.executor_backend == "rust"
|
||||
assert cfg.executor_transport == "tcp"
|
||||
assert cfg.executor_socket_path == "/var/run/aether.sock"
|
||||
assert cfg.executor_base_url == "http://127.0.0.1:9311"
|
||||
assert cfg.executor_request_timeout == 12.5
|
||||
Reference in New Issue
Block a user