Why: The live deploy journal never called fault injection, and test-lifecycle failed closed on login so CI could not require the real combination cases. Evidence: SELF python3 -m unittest tests.test_svc_u2.U2ReleaseTests -q exit 0 (35 ok, 1 skipped) on 3602a87; receipt sha256 9b5785577751e8e9e7947cf9700fb8854b1c80142f34273ae25f3097ee4c9aa8. Impact: test-pg builds the Dev binary and runs make test-lifecycle. Login and full-track deploy without SVC_RDM_ORIGIN stay NOT_RUN. No live data move and no account CLI. Refs: recovery plan D2/D3; Dev #485 Co-authored-by: Cursor <cursoragent@cursor.com>
61 lines
2.3 KiB
Python
61 lines
2.3 KiB
Python
"""真实 Dev/RDM 组合门禁。由 make test-lifecycle 调用。
|
||
|
||
缺 PostgreSQL、RDM 源码或制品时直接失败,不静默跳过。
|
||
登录依赖账户 CLI 公共化(账户方案 U7/U5),单独标 NOT_RUN,
|
||
不因此把已经跑过的真实组合场景记成失败。
|
||
"""
|
||
import os
|
||
import subprocess
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(__file__).resolve().parents[3]
|
||
PIN = Path(__file__).resolve().parent / "rdm.pin"
|
||
|
||
|
||
def main():
|
||
missing = []
|
||
if not os.environ.get("AGENT_PG_TEST_DSN"):
|
||
missing.append("AGENT_PG_TEST_DSN")
|
||
src = os.environ.get("SVC_RDM_SRC_DIR", "")
|
||
if not src or not Path(src).is_dir():
|
||
missing.append("SVC_RDM_SRC_DIR")
|
||
dev = os.environ.get("SVC_REAL_BIN") or str(ROOT / "bin" / "agent-system")
|
||
rdm = os.environ.get("SVC_REAL_RDM_BIN", "")
|
||
if not Path(dev).is_file():
|
||
missing.append("Dev 制品(SVC_REAL_BIN 或 bin/agent-system)")
|
||
if not rdm or not Path(rdm).is_file():
|
||
missing.append("RDM 制品(SVC_REAL_RDM_BIN)")
|
||
if missing:
|
||
print("test-lifecycle 失败。缺:%s" % ", ".join(missing))
|
||
return 1
|
||
|
||
print("组合清单")
|
||
print("pin", PIN.read_text().strip())
|
||
print("rdm_src", src)
|
||
print("dev_bin", dev)
|
||
print("rdm_bin", rdm)
|
||
print("将运行 tests.test_svc_realcombo:SQLite 身份、RDM 二进制生命周期、PostgreSQL 身份环境交付")
|
||
if os.environ.get("SVC_RDM_ORIGIN"):
|
||
print("将运行全轨部署:SVC_RDM_ORIGIN 已设置")
|
||
else:
|
||
print("全轨部署 NOT_RUN:未设置 SVC_RDM_ORIGIN(由 svc-realcombo 作业覆盖)")
|
||
print("登录 NOT_RUN:RDM 二进制没有 user/apikey,工作台登录依赖账户方案 U7/U5")
|
||
env = os.environ.copy()
|
||
env["SVC_TEST_REAL"] = "1"
|
||
env["SVC_TEST_PG"] = "1"
|
||
env["SVC_REAL_BIN"] = dev
|
||
env["SVC_REAL_RDM_BIN"] = rdm
|
||
proc = subprocess.run(
|
||
[sys.executable, "-m", "unittest", "tests.test_svc_realcombo", "-q"],
|
||
cwd=str(ROOT), env=env)
|
||
if proc.returncode != 0:
|
||
print("test-lifecycle 失败:真实组合用例未通过")
|
||
return proc.returncode
|
||
print("test-lifecycle 可跑场景通过;登录与未设 origin 的全轨部署保持 NOT_RUN")
|
||
return 0
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|