Files
meshcore-analyzer/test-all.sh
you 629606bbdd feat: optimize observations table schema (v3 migration)
- Replace observer_id TEXT (64-char hex) + observer_name TEXT with observer_idx INTEGER (FK to observers rowid)
- Remove redundant hash TEXT and created_at TEXT columns from observations
- Store timestamp as INTEGER epoch seconds instead of ISO text string
- Auto-migrate old schema on startup: backup DB, migrate data, rebuild indexes, VACUUM
- Migration is safe: backup first, abort on failure, schema_version marker prevents re-runs
- Backward-compatible packets_v view: JOINs observers table, converts epoch→ISO for consumers
- In-memory observer_id→rowid Map for fast lookups during ingestion
- In-memory dedup Set with 5-min TTL to prevent duplicate INSERT attempts
- packet-store.js: detect v3 schema and use appropriate JOIN query
- Tests: 29 migration tests (old→new, idempotency, backup failure, ingestion, dedup)
- Tests: 19 new v3 schema tests in test-db.js (columns, types, view compat, ingestion)

Expected savings on 947K-row prod DB:
- observer_id: 61 bytes → 4 bytes per row (57 bytes saved)
- observer_name: ~15 bytes → 0 (resolved via JOIN)
- hash: 16 bytes → 0 (redundant with transmission_id)
- timestamp: 25 bytes → 4 bytes (21 bytes saved)
- created_at: 25 bytes → 0 (redundant)
- Dedup index: much smaller (integers vs text)
- Estimated ~118 bytes saved per row = ~112MB total + massive index savings
2026-03-25 19:13:22 +00:00

36 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# Run all tests with coverage
set -e
echo "═══════════════════════════════════════"
echo " MeshCore Analyzer — Test Suite"
echo "═══════════════════════════════════════"
echo ""
# Unit tests (deterministic, fast)
echo "── Unit Tests ──"
node test-decoder.js
node test-decoder-spec.js
node test-packet-store.js
node test-packet-filter.js
node test-aging.js
node test-frontend-helpers.js
node test-regional-filter.js
node test-server-helpers.js
node test-server-routes.js
node test-db.js
node test-db-migration.js
# Integration tests (spin up temp servers)
echo ""
echo "── Integration Tests ──"
node tools/e2e-test.js
node tools/frontend-test.js
echo ""
echo "═══════════════════════════════════════"
echo " All tests passed"
echo "═══════════════════════════════════════"
node test-server-routes.js
# test trigger