fix: pin model revisions and quarantine MariaDB CI routing
MariaDB persistence qualification / mariadb (push) Has been cancelled
MariaDB persistence qualification / mariadb (push) Has been cancelled
This commit is contained in:
@@ -84,6 +84,37 @@ def test_health_reports_runtime_without_ollama_and_without_forcing_model_load(mo
|
||||
assert payload["ollama_loaded_models"] == []
|
||||
|
||||
|
||||
def test_model_load_pins_both_artifacts_and_denies_remote_code_and_unsafe_weights(monkeypatch):
|
||||
module = load_app_module(monkeypatch)
|
||||
calls = []
|
||||
|
||||
class LoadedModel:
|
||||
def eval(self):
|
||||
return self
|
||||
|
||||
def to(self, device):
|
||||
return self
|
||||
|
||||
def tokenizer_loader(name, **options):
|
||||
calls.append((name, options))
|
||||
return object()
|
||||
|
||||
def model_loader(name, **options):
|
||||
calls.append((name, options))
|
||||
return LoadedModel()
|
||||
|
||||
monkeypatch.setattr(module.AutoTokenizer, "from_pretrained", tokenizer_loader)
|
||||
monkeypatch.setattr(module.AutoModelForSeq2SeqLM, "from_pretrained", model_loader)
|
||||
monkeypatch.setattr(module.torch.cuda, "is_available", lambda: False)
|
||||
module._load_runtime()
|
||||
|
||||
assert [name for name, _ in calls] == ["sshleifer/distilbart-cnn-12-6"] * 2
|
||||
for _, options in calls:
|
||||
assert options.get("revision") == "a4f8f3ea906ed274767e9906dbaede7531d660ff"
|
||||
assert options.get("trust_remote_code") is False
|
||||
assert calls[1][1].get("weights_only") is True
|
||||
|
||||
|
||||
def test_summarize_returns_503_with_explicit_reason_when_model_loading_is_disabled(monkeypatch):
|
||||
module = load_app_module(monkeypatch)
|
||||
client = TestClient(module.app)
|
||||
|
||||
Reference in New Issue
Block a user