- tests/docgen/:DC-UNIT/API/CONF/E2E/UI/REGRESSION/PERF 分组用例与可复跑脚本,报告逐条留痕(R1-R3 全记录) - 意图 30 条前后端同表双跑(pytest + node) - Playwright headless:docgen-ui/docgen-regression spec + b3 benchpanel 第 5 TAB 断言更新 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""tests/docgen/fake_remote_vstore.py —— DC-CONF 受控假远端(非生产端口)。
|
|
|
|
用法:
|
|
<venv>/bin/python tests/docgen/fake_remote_vstore.py --port 8194 # 正常模式:/health 200、空检索 []
|
|
<venv>/bin/python tests/docgen/fake_remote_vstore.py --port 8194 --reject # 拒绝模式:/health 404(握手必败)
|
|
|
|
仅本机 127.0.0.1、仅测试用;不触碰生产端口。
|
|
"""
|
|
import argparse
|
|
|
|
import uvicorn
|
|
from fastapi import FastAPI
|
|
|
|
app = FastAPI(title="fake-remote-vstore")
|
|
|
|
|
|
@app.get("/health")
|
|
def health():
|
|
if REJECT:
|
|
from fastapi import HTTPException
|
|
|
|
raise HTTPException(status_code=404, detail="no vstore here")
|
|
return {"ok": True, "service": "vstore"}
|
|
|
|
|
|
@app.get("/api/vstore/search")
|
|
def search(q: str = "", top_k: int = 8, category: str = "", as_template: str = ""):
|
|
return {"ok": True, "mode": "vector", "items": []}
|
|
|
|
|
|
REJECT = False
|
|
|
|
if __name__ == "__main__":
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument("--port", type=int, default=8194)
|
|
ap.add_argument("--reject", action="store_true")
|
|
args = ap.parse_args()
|
|
REJECT = args.reject
|
|
uvicorn.run(app, host="127.0.0.1", port=args.port, log_level="warning")
|