round-12: fix integration fallout (P9 gate x P1, P7 check x P2/P4 fixtures)

- P1 resident tests: P9's inference gate is a precondition of
  _run_with_vm, so _RealExecCase.make_executor now configures a
  default inference origin (CHV_INFERENCE_ORIGIN=https://xgapi.lol
  + CHV_INFERENCE_ALLOW_HOSTS=xgapi.lol) and a public fake resolver
  (same setup as P9's GateTest). No assertion changed; the gate's
  fail-closed behavior on missing origin stays pinned by P9's own
  ask test. 9 resident tests fixed (7 errors + 2 failures).
- P2/P4 dry-run fixtures: P7's build.sh hard check requires
  chv-memory.py in the repo; add it to both fixtures' copy lists.
  2 failures fixed.
- No production code changed in this commit (test setup only).
This commit is contained in:
host committed 2026-11-07 00:43:50 +00:00
1 parent d4cef29cdb
commit da8d0c29fd
3 files changed
+16 -3

No files matched your search

+14 -1
View File
@@ -113,6 +113,11 @@ class _FakeExecutor:
self.emits.append(event) self.emits.append(event)
def _public_resolver(host, port):
"""假解析器:公网 IP(与 P9 测试同款,供推理门放行用)。"""
return ["93.184.216.34"]
def _write(path, content): def _write(path, content):
with open(path, "w") as fh: with open(path, "w") as fh:
fh.write(content) fh.write(content)
@@ -485,9 +490,16 @@ class _RealExecCase(unittest.TestCase):
@staticmethod @staticmethod
def make_executor(state_dir, base_dir, env_extra=None): def make_executor(state_dir, base_dir, env_extra=None):
# round-12:P9 推理门是 _run_with_vm 的前置条件——本类
# 的任务都不带 model_provider,须配默认推理 origin +
# 公网解析器才放行(与 P9 GateTest 同款;未配时门应
# fail-closed,见 test_chv_muse_p9 的 ask 用例——这里
# 测的是常驻接线本身,不是门的行为,所以配好放行)。
env = {"CHV_EGRESS_PROXY": "http://10.0.0.1:8888", env = {"CHV_EGRESS_PROXY": "http://10.0.0.1:8888",
"CHV_HOST_KEY_MODE": "keyscan", "CHV_HOST_KEY_MODE": "keyscan",
"CHV_SSH_FORWARD": "1"} "CHV_SSH_FORWARD": "1",
"CHV_INFERENCE_ORIGIN": "https://xgapi.lol",
"CHV_INFERENCE_ALLOW_HOSTS": "xgapi.lol"}
if env_extra: if env_extra:
env.update(env_extra) env.update(env_extra)
cpuinfo = os.path.join(base_dir, "cpuinfo") cpuinfo = os.path.join(base_dir, "cpuinfo")
@@ -506,6 +518,7 @@ class _RealExecCase(unittest.TestCase):
state_dir=state_dir, state_dir=state_dir,
sleeper=lambda s: None, env=env) sleeper=lambda s: None, env=env)
ex.audit_callback = lambda e, t, d, k=None: None ex.audit_callback = lambda e, t, d, k=None: None
ex.sentinel_resolver = _public_resolver
return ex return ex
def setUp(self): def setUp(self):
+1 -1
View File
@@ -552,7 +552,7 @@ class BuildDryRunTest(unittest.TestCase):
"authd.py", "git-credential-chv-authd", "authd.py", "git-credential-chv-authd",
"chv-authd.service", "chv-authd.service",
"chv-cdp-broker.py", "chv_browser_guard.py", "chv-cdp-broker.py", "chv_browser_guard.py",
"browser-blocklist.txt"): "browser-blocklist.txt", "chv-memory.py"):
shutil.copy2(ROOT / "chv-guest" / name, shutil.copy2(ROOT / "chv-guest" / name,
os.path.join(guest, name)) os.path.join(guest, name))
shutil.copy2(ROOT / "host.py", os.path.join(repo, "host.py")) shutil.copy2(ROOT / "host.py", os.path.join(repo, "host.py"))
+1 -1
View File
@@ -718,7 +718,7 @@ class BuildDryRunTest(unittest.TestCase):
"chv-cdp-broker.py", "chv_browser_guard.py", "chv-cdp-broker.py", "chv_browser_guard.py",
"browser-blocklist.txt", "browser-blocklist.txt",
"authd.py", "git-credential-chv-authd", "authd.py", "git-credential-chv-authd",
"chv-authd.service"): "chv-authd.service", "chv-memory.py"):
shutil.copy2(ROOT / "chv-guest" / name, shutil.copy2(ROOT / "chv-guest" / name,
os.path.join(guest, name)) os.path.join(guest, name))
shutil.copy2(ROOT / "host.py", os.path.join(repo, "host.py")) shutil.copy2(ROOT / "host.py", os.path.join(repo, "host.py"))