Files
rf4-spotter/deploy/test-tackle-query-plans.sh
T
ik 46251c635f
CI / backend-and-migrations (push) Waiting to run
CI / astro-build (push) Waiting to run
CI / dependency-audit (push) Waiting to run
CI / compose-e2e (push) Waiting to run
test: add tackle query acceptance gate
2026-09-20 18:36:37 +07:00

25 lines
885 B
Bash
Executable File

#!/bin/sh
set -eu
repo=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
output=$(mktemp)
cleanup() { rm -f "$output"; }
trap cleanup EXIT INT TERM
docker compose exec -T db psql -X -U rf4 -d rf4_spotter \
< "$repo/deploy/tackle-query-plan-gate.sql" > "$output"
for plan in tackle_catalog_filter tackle_combinations; do
grep -F "PLAN $plan" "$output" >/dev/null
done
awk '
/Execution Time:/ { count += 1; if (($3 + 0) > 250) { print "Tackle query plan exceeded 250 ms: " $0 > "/dev/stderr"; failed = 1 } }
END { if (count != 2 || failed) exit 1 }
' "$output"
grep -A40 'PLAN tackle_catalog_filter' "$output" | grep -Eq 'Index Scan|Index Only Scan|Bitmap Index Scan'
grep -A60 'PLAN tackle_combinations' "$output" | grep -Eq 'Index Scan|Bitmap Index Scan'
grep 'Execution Time:' "$output"
echo "Tackle query-plan gate passed: indexed catalog and combination paths under 250 ms"