Test navigateur isolé du réseau de la machine ; zstd seulement si Node le sait

Le conteneur Playwright partageait le réseau de la machine : quand d'autres
conteneurs démarraient, Chromium abandonnait ses chargements
(net::ERR_NETWORK_CHANGED). Il a maintenant son réseau, et le vrai serveur
tourne à côté de lui. Ce Node (20) n'a pas zstd : le serveur renvoyait 500.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-23 03:00:34 +01:00
co-authored by Claude Opus 5.5
parent b037fbd67f
commit 442b3f0a56
4 changed files with 42 additions and 12 deletions
+6 -8
View File
@@ -110,15 +110,13 @@ test-browser: $(PLAYWRIGHT) $(QR_READER) ## Parcours Playwright de l'app, captur
@tmp="$$(mktemp -d)"; data="$$tmp/data"; site="$$tmp/build/site"; \
trap 'kill $$pid 2>/dev/null; rm -rf -- "$$tmp"' EXIT; \
$(MAKE) --no-print-directory site SITE_BUILD="$$tmp/build" >/dev/null || exit 1; \
port="$$(node -e 'const s=require("node:net").createServer().listen(0,"127.0.0.1",()=>{console.log(s.address().port);s.close()})')"; \
PORT="$$port" SITE_DIR="$$site" DATA_DIR="$$data" PUBLIC_URL="http://127.0.0.1:$$port" \
node server/main.js >"$$tmp/server.log" 2>&1 & pid=$$!; \
for _ in $$(seq 50); do curl -sf -o /dev/null "http://127.0.0.1:$$port/" && break; sleep 0.1; done; \
curl -sf -o /dev/null "http://127.0.0.1:$$port/" || { echo "Le serveur ne démarre pas :"; cat "$$tmp/server.log"; exit 1; }; \
docker run --rm --init --ipc=host --network host -u "$$(id -u):$$(id -g)" -e HOME=/tmp \
-v "$(CURDIR)/$(APP_DIR):/app:ro" -v "$(CURDIR)/tests/browser:/tests:ro" -v "$$site:/site" \
mkdir -p "$$data"; \
docker run --rm --init --ipc=host --network bridge -u "$$(id -u):$$(id -g)" -e HOME=/tmp \
-v "$(CURDIR)/$(APP_DIR):/repo/app:ro" -v "$(CURDIR)/server:/repo/server:ro" -v "$(CURDIR)/package.json:/repo/package.json:ro" \
-v "$(CURDIR)/tests/browser:/tests:ro" \
-v "$$site:/site" -v "$$data:/data" \
-v "$(CURDIR)/$(BROWSER_TOOLS):/tools:ro" -v "$(CURDIR)/build/shots:/shots" \
$(PLAYWRIGHT_IMAGE) node /tests/parcours.cjs /app /shots "http://127.0.0.1:$$port/"
$(PLAYWRIGHT_IMAGE) sh /tests/run.sh
test-site: ## Construit l'image de production en local et vérifie ce qu'elle sert (Docker)
@tests/test_site.sh