修复运行时凭证与网络出口兼容性

This commit is contained in:
2026-08-27 23:19:13 +08:00
parent 56c618db59
commit ad1df5387e
3 changed files with 59 additions and 14 deletions

View File

@@ -42,6 +42,19 @@ class AutoAdaptationTests(unittest.TestCase):
token = resolve_runtime_token({"EXTERNAL_SERVICE_TOKEN": "private-value"})
self.assertEqual(token, "private-value")
def test_runtime_token_file_is_supported(self):
token = resolve_runtime_token(
{"XC_TOKEN_FILE": "/run/secrets/xc-token"},
read_text=lambda path: "mounted-private-value\n"
if path == "/run/secrets/xc-token"
else "",
)
self.assertEqual(token, "mounted-private-value")
def test_placeholder_runtime_token_is_rejected(self):
token = resolve_runtime_token({"EXTERNAL_SERVICE_TOKEN": "tmp"})
self.assertEqual(token, "")
def test_explicit_modelhub_token_takes_precedence(self):
token = resolve_runtime_token(
{