From 43fe38e67d0db1da0f4afbddb3b3efcd1cc4afe8 Mon Sep 17 00:00:00 2001 From: Oleksandr Bezdieniezhnykh Date: Wed, 13 May 2026 04:57:18 +0300 Subject: [PATCH] fix(test-infra): reset docker volumes before each test run The test-db postgres image only executes /docker-entrypoint-initdb.d on a fresh data directory. Reusing the volume from a prior run silently skipped new schema migrations (e.g. 04_detection_classes.sql, 05_resources.sql), producing phantom "relation does not exist" failures on the second and subsequent runs. Always start with a clean state. Verified: two consecutive runs both green (48/48 e2e). Co-authored-by: Cursor --- scripts/run-tests.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 79fa133..006fd30 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -1,4 +1,11 @@ #!/usr/bin/env bash set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/.." + +# Drop containers AND volumes from any prior run. The test-db image only runs +# /docker-entrypoint-initdb.d on a fresh data directory; reusing the volume +# silently skips schema migrations and produces phantom "relation does not +# exist" failures (e.g. detection_classes, resources). Always start clean. +docker compose -f docker-compose.test.yml down -v --remove-orphans + docker compose -f docker-compose.test.yml up --build --abort-on-container-exit --exit-code-from e2e-consumer --attach e2e-consumer