proxy: a path of the box is said to no client, and its test reads no key of the box

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hasan BasbunarandClaude Opus 5.5 committed 2026-11-30 14:29:26 +01:00
1 parent 6b94ab7e1d
commit 9ea4510dd6
2 files changed
+19 -1

No files matched your search

+3 -1
View File
@@ -845,7 +845,9 @@ def engine_gone():
def why_unreachable(why):
"""What an engine that does not answer is said by, in words: an exception's, without Python's dressing,
or what a caller of this wrote, a secret masked."""
text = str(getattr(why, "reason", None) or why)
why = getattr(why, "reason", None) or why
# an error of a file names it: a path of the box is no client's
text = why.strerror if isinstance(why, OSError) and why.filename and why.strerror else str(why)
text = re.sub(r"<urlopen error (.*)>", r"\1", text)
return mask_text(re.sub(r"\[Errno -?\d+\] ", "", text))[:400]
+16
View File
@@ -54,6 +54,7 @@ def load(upstream):
spec.loader.exec_module(mod)
mod.journal = []
mod.log = mod.journal.append
mod._api_key = lambda: KEY # never the key of the box that runs the suite, nor its absence
for name in ("image_lane_serving", "video_lane_serving", "transcribe_lane_serving"):
setattr(mod, name, lambda: None)
return mod
@@ -160,6 +161,21 @@ class NoLane(Base):
self.assertTrue([ln for ln in mod.journal if ln == "engine unreachable: Connection refused"], mod.journal)
def test_a_path_of_the_box_stays_here(self):
mod = self.serve(self.nobody)
mod.HOLD_UNITS, mod.HOLD_MAX_S = UNITS, 0
mod.subprocess = SimpleNamespace(run=systemd(("inactive", "inactive")))
def missing():
raise FileNotFoundError(2, "No such file or directory", "/home/someone/.config/qwen38/api-key")
mod._api_key = missing
status, _, raw = self.ask("/v1/systemone", b'{"state": "s", "model": "jev-latest", "questions": '
b'{"a": {"type": "noul", "instructions": "x?"}}}')
self.assertEqual(status, 503, raw)
self.assertNotIn(b"/home/someone", raw)
self.assertIn(b"No such file or directory", raw)
class WhatTheEngineSaid(Base):
def said(self, body, ctype="application/json", path="/v1/chat/completions"):
Engine.says = (503, body, ctype)