mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-12-06 11:14:26 +00:00
* ci: create the owner-auth database in the smoke stack The backend derives its owner connection from DATABASE_URL with the database name swapped for meshcore_owner_auth, and dies at startup when that database is absent. Production creates it out of band (newuser.sh, restore-drill.sh); a fresh CI volume never did, so 'Build every application image and smoke an empty-volume stack' failed with 'database meshcore_owner_auth does not exist'. Mirror production: an init-hook script creates the database and applies the shipped owner-auth.sql to it. The SQL is mounted outside initdb so it is not applied to the main database as well. * test(tagger): build the fixture in the post-move ops namespace The suite creates its own database and then runs the worker's real poll SQL, which reads ops.public_visibility_state, ops.packet_visibility_materialization_state, ops.privacy_rematerialization_queue and ops.tagger_retry since the P1 moves. The fixture still created those tables in public, so all eight tests failed with 'relation "ops.packet_visibility_materialization_state" does not exist'. This was masked until now: the smoke stack never got past backend startup, so this step never ran. packets and message_tags stay unqualified - the worker resolves those through the connection search_path, as the deployed P1 search_path does. Verified against a disposable TimescaleDB with the same invocation CI uses: 8 tests, OK. * ci: read the smoke-stack assertions from the post-move schemas The empty-volume smoke readback still queried nodes, packets, packet_paths and packet_hourly_stats by their pre-move public names. 116/123/124/125 moved them to core and mesh, so the psql step failed with 'relation "packet_hourly_stats" does not exist' once the stack got far enough to run it. Use the canonical names; the public spellings are compatibility views at best and for two of these relations no longer exist. * test(e2e): warm the MapLibre module graph during setup maplibre-gl is excluded from optimizeDeps because Vite's pre-bundling rewrites the worker URL and kills it, so the first cold request pays for transforming the whole module graph. On the CI runner that is 41-47s for maplibre-gl-worker.mjs (measured from the retained traces on run 41887037964), which is most of the 60s map-health budget in the map specs: the map starts ~57s after the document load and the assertion expires just before the basemap turns healthy. Playwright starts webServer before globalSetup, so warm the two heaviest dev-server modules there. The cost moves into setup; assertions stay tight. Failures are logged and ignored - this is never a gate. Fixes #190 * test(e2e): log module warm-up response shape The CI warm-up reported 200/116ms, but the browser still waited 47.8s for the worker module and the map stayed loading. Log Content-Length and Content-Type for each warm-up response so we can distinguish the transformed worker from a fast SPA fallback before changing the fix.
26 lines
1.0 KiB
Bash
Executable File
26 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Create the owner-auth database the backend expects.
|
|
#
|
|
# The backend derives OWNER_DATABASE_URL from DATABASE_URL by swapping the
|
|
# database name (default `meshcore_owner_auth`), and `backend/src/db/owner-auth.sql`
|
|
# is the only thing that defines its tables. A fresh CI volume seeds the main
|
|
# database from base.sql but never creates this second database, so the backend
|
|
# dies at startup with `database "meshcore_owner_auth" does not exist`.
|
|
#
|
|
# Production creates it out of band (scripts/newuser.sh, restore-drill.sh), so
|
|
# this mirrors that step for the CI stack instead of pointing CI at a different
|
|
# shape than production.
|
|
set -eu
|
|
|
|
owner_db="${OWNER_POSTGRES_DB:-meshcore_owner_auth}"
|
|
|
|
exists="$(psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d postgres -tAc \
|
|
"SELECT 1 FROM pg_database WHERE datname = '${owner_db}'")"
|
|
if [ "$exists" != "1" ]; then
|
|
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d postgres \
|
|
-c "CREATE DATABASE \"${owner_db}\""
|
|
fi
|
|
|
|
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$owner_db" \
|
|
-f /opt/bootstrap/owner-auth.sql
|