Relecture : le serveur ne construit jamais l image, réseau retenu par le .env, tâches arrêter
- docs/production.md : seuls compose.yml, compose.reseau.yml et verifier.py vont sur le serveur ; docker compose up -d --no-build ; COMPOSE_FILE dans ~/ollama/.env ; relance par Compose plutôt que docker start ; docker logout après le pull. - verifier.py lisible par Python 3.8/3.9. - Tâches « Instance de test : arrêter » et « Ollama : arrêter ». Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f4c493770e
commit
3e0b5d03a3
6 files changed
+90
-9
No files matched your search
@@ -1,4 +1,5 @@
|
||||
"""L'image Ollama : le script de vérification (contre un faux serveur) et les garde-fous du lancement (design §2, §5)."""
|
||||
import ast
|
||||
import json
|
||||
import socket
|
||||
import sys
|
||||
@@ -80,6 +81,18 @@ class TestVerifier(unittest.TestCase):
|
||||
verifier(f"http://127.0.0.1:{port}/v1")
|
||||
|
||||
|
||||
class TestCompatibilite(unittest.TestCase):
|
||||
def test_verifier_lisible_par_un_vieux_python(self): # le Python du serveur est inconnu (3.8, 3.9…)
|
||||
texte = (OLLAMA / "verifier.py").read_text()
|
||||
arbre = ast.parse(texte)
|
||||
futur = any(isinstance(n, ast.ImportFrom) and n.module == "__future__"
|
||||
and any(a.name == "annotations" for a in n.names) for n in arbre.body)
|
||||
unions = [n for n in ast.walk(arbre) if isinstance(n, (ast.FunctionDef, ast.arg))
|
||||
for a in [n.returns if isinstance(n, ast.FunctionDef) else n.annotation]
|
||||
if a is not None and any(isinstance(b, ast.BinOp) for b in ast.walk(a))]
|
||||
self.assertTrue(futur or not unions, "annotations « X | None » évaluées à la définition : Python ≥ 3.10")
|
||||
|
||||
|
||||
class TestLancement(unittest.TestCase):
|
||||
def test_port_lie_a_localhost_par_defaut(self): # Ollama n'a pas d'authentification
|
||||
self.assertIn('"${OLLAMA_BIND:-127.0.0.1}:${OLLAMA_PORT:-11434}:11434"', COMPOSE.read_text())
|
||||
|
||||
Reference in new issue
Block a user