smoke: REST API regression harness + baseline snapshots (Meteor 1.6.1.1)

Adds a standalone Node smoke test (smoke/) that exercises every REST endpoint
consumed by the Flutter app against a seeded local dev server and compares
responses to committed snapshots. This is the safety net for the Meteor upgrade:
it must stay byte-identical after every escala.

- smoke/seed.js: deterministic Mongo seed (fixed ObjectIds, geo indexes)
- smoke/run.js: calls endpoints, normalizes volatile fields, diffs snapshots
- smoke/smoke.sh: seed + run wrapper
- smoke/snapshots/: baseline captured on Meteor 1.6.1.1
- IPGeocoder.js: degrade gracefully when MaxMind DB absent (dev boot)
- settings-development.json: dev-only internalApiToken to enable the REST API
- .meteorignore: exclude smoke/ from the Meteor server build
This commit is contained in:
vjrj 2026-07-13 19:42:55 +02:00
parent 39415808bf
commit 296dab4f38
18 changed files with 539 additions and 4 deletions

25
smoke/smoke.sh Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Seed the dev Mongo deterministically and run the REST smoke test.
#
# smoke/smoke.sh # compare against committed baseline snapshots
# smoke/smoke.sh --update # (re)generate the baseline snapshots
#
# Env overrides:
# MONGO_CONTAINER docker container running the dev Mongo (default tcef-mongo32)
# MONGO_DB database name (default fuegos)
# BASE_URL dev server URL (default http://localhost:3100)
set -euo pipefail
cd "$(dirname "$0")/.."
MONGO_CONTAINER="${MONGO_CONTAINER:-tcef-mongo32}"
MONGO_DB="${MONGO_DB:-fuegos}"
echo "== Seeding ${MONGO_DB} in ${MONGO_CONTAINER} =="
# Copy the script in and run it as a whole file: the mongo shell evaluates a
# file argument atomically (piping via stdin is line-by-line and breaks on
# multi-line comments / var scope).
docker cp smoke/seed.js "${MONGO_CONTAINER}:/tmp/tcef-seed.js"
docker exec "${MONGO_CONTAINER}" mongo "${MONGO_DB}" /tmp/tcef-seed.js | tail -1
echo "== Running REST smoke test against ${BASE_URL:-http://localhost:3100} =="
node smoke/run.js "$@"