fix(orchestrator): bound streamed request bodies
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
import urllib.error
|
||||
from unittest.mock import MagicMock, patch
|
||||
@@ -20,6 +22,30 @@ from bot_bottle.orchestrator.client import (
|
||||
_URLOPEN = "bot_bottle.orchestrator.client.urllib.request.urlopen"
|
||||
|
||||
|
||||
class TestImportBoundary(unittest.TestCase):
|
||||
def test_host_client_does_not_import_server_dependencies(self) -> None:
|
||||
script = """
|
||||
import importlib.abc
|
||||
import sys
|
||||
|
||||
class BlockServerDependencies(importlib.abc.MetaPathFinder):
|
||||
def find_spec(self, fullname, path=None, target=None):
|
||||
if fullname.split(".", 1)[0] in {"fastapi", "uvicorn"}:
|
||||
raise ImportError(f"host import reached {fullname}")
|
||||
return None
|
||||
|
||||
sys.meta_path.insert(0, BlockServerDependencies())
|
||||
import bot_bottle.orchestrator.client
|
||||
"""
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-c", script],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
|
||||
|
||||
class TestHostAuthToken(unittest.TestCase):
|
||||
def test_mints_a_cli_token_from_the_host_key(self) -> None:
|
||||
# The CLI mints its `cli` token from the control-plane trust domain's
|
||||
|
||||
Reference in New Issue
Block a user