Ne pas générer d overview locale sur la webapp légère (géométrie divergente du worker)

This commit is contained in:
Antoine Jacquin
2026-09-20 01:05:08 +02:00
parent b622d55720
commit 1d722ff10c
3 changed files with 41 additions and 7 deletions

View File

@ -340,7 +340,7 @@ def test_rebuild_flag_synchronous(monkeypatch):
go = threading.Event()
def slow_build(out):
def slow_build(out, **kw):
go.wait(2) # rebuild artificiellement long
monkeypatch.setattr(index_mod, "build_index", slow_build)
@ -855,13 +855,38 @@ def test_available_layers_scans_disk(tmp_path, monkeypatch):
assert "aspect" not in layers
def test_local_rebuild_skips_overview(tmp_path, monkeypatch):
"""Webapp légère (GENERATION_URL) : pas de mosaïques d'overview locales.
Bâties sur un cache partiel, leur géométrie diffère (autre px/km, autre
étendue) de celles du worker sous le MÊME nom de fichier : plus récentes
(mtime), elles seraient servies à la place et désaligneraient le payload.
"""
import time
import lidar_pipeline.webapp as webapp
import lidar_pipeline.index as index_mod
monkeypatch.setattr(webapp, "OUTPUT_DIR", tmp_path)
monkeypatch.setattr(webapp, "GENERATION_URL", "http://distant:8973")
seen = {}
monkeypatch.setattr(index_mod, "build_index",
lambda out, **kw: seen.update(kw) or None)
webapp._rebuild.update({"running": False})
assert webapp._start_rebuild()["demarré"] is True
for _ in range(200):
if not webapp._rebuild["running"]:
break
time.sleep(0.02)
assert seen.get("generate_overview") is False
def test_rebuild_index_background(tmp_path, monkeypatch):
"""POST /api/rebuild lance build_index en arrière-plan puis termine."""
import time as _time
import lidar_pipeline.webapp as webapp
import lidar_pipeline.index as index_mod
calls = []
monkeypatch.setattr(index_mod, "build_index", lambda out: calls.append(out))
monkeypatch.setattr(index_mod, "build_index", lambda out, **kw: calls.append(out))
assert webapp.rebuild_index()["demarré"] is True
for _ in range(100):
if not webapp.rebuild_status()["running"]:
@ -1024,7 +1049,7 @@ def test_sync_is_rebuild_only(tmp_path, monkeypatch):
import lidar_pipeline.webapp as webapp
import lidar_pipeline.index as index_mod
calls = []
monkeypatch.setattr(index_mod, "build_index", lambda out: calls.append(out))
monkeypatch.setattr(index_mod, "build_index", lambda out, **kw: calls.append(out))
webapp._rebuild["done"] = None # ignore l'état d'un test précédent
assert webapp.sync_and_rebuild()["demarré"] is True
for _ in range(200):