From 71f05308e9c7d621f3447342fb00904ea36990b5 Mon Sep 17 00:00:00 2001 From: bot-backend Date: Sun, 31 May 2026 18:42:17 +0300 Subject: [PATCH] =?UTF-8?q?chore(tradein):=20browser-smoke.sh=20=E2=80=94?= =?UTF-8?q?=20verify=20tradein-browser=20/health=20+=20/fetch=20(#905)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reusable smoke test for the camoufox HTTP service. Run from the deploy host: docker exec -i tradein-backend sh < tradein-mvp/scripts/browser-smoke.sh Reports health, byte count, preloadedState presence, firewall-block detection + first 200 bytes of the response. Avoids long one-line curl commands that get mangled on terminal paste. Refs #905, #883 --- tradein-mvp/scripts/browser-smoke.sh | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tradein-mvp/scripts/browser-smoke.sh diff --git a/tradein-mvp/scripts/browser-smoke.sh b/tradein-mvp/scripts/browser-smoke.sh new file mode 100644 index 00000000..846b011a --- /dev/null +++ b/tradein-mvp/scripts/browser-smoke.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Smoke-test the tradein-browser service (camoufox HTTP wrapper, #905) from +# inside the tradein docker network. Verifies /health and a real /fetch. +# +# Run from the deploy host (after `git pull`), piping the script into the +# backend container (which shares the tradein-net with tradein-browser): +# +# docker exec -i tradein-backend sh < tradein-mvp/scripts/browser-smoke.sh +# +# Override the target URL: +# URL=https://example.com docker exec -i -e URL tradein-backend sh < tradein-mvp/scripts/browser-smoke.sh +set -eu + +B="${BROWSER_HTTP_ENDPOINT:-http://tradein-browser:3000}" +U="${URL:-https://www.avito.ru/ekaterinburg/kvartiry/prodam}" + +printf 'health: ' +curl -s --max-time 10 "$B/health" || echo "(no response)" +echo + +echo "{\"url\":\"$U\"}" > /tmp/smoke_payload.json +curl -s --max-time 120 -X POST "$B/fetch" \ + -H 'Content-Type: application/json' \ + -d @/tmp/smoke_payload.json \ + -o /tmp/smoke_result.html || true + +echo "url: $U" +echo "bytes: $(wc -c < /tmp/smoke_result.html 2>/dev/null || echo 0)" +echo "preloaded: $(grep -c preloadedState /tmp/smoke_result.html 2>/dev/null || echo 0)" +echo "firewall: $(grep -ci firewall-container /tmp/smoke_result.html 2>/dev/null || echo 0)" +echo "--- first 200 bytes (error JSON shows here if /fetch failed) ---" +head -c 200 /tmp/smoke_result.html 2>/dev/null || true +echo