From 7affdb9be930189fc97f0a9c090b1ec781410835 Mon Sep 17 00:00:00 2001 From: Roman Meshko Date: Wed, 6 May 2026 13:56:34 +0300 Subject: [PATCH] Fixed state before e2e tests --- .woodpecker/01-test.yml | 6 +++++- e2e/docker-compose.test.yml | 6 +++--- e2e/run_test.sh | 13 +++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.woodpecker/01-test.yml b/.woodpecker/01-test.yml index 338dc3d..3f5878d 100644 --- a/.woodpecker/01-test.yml +++ b/.woodpecker/01-test.yml @@ -20,7 +20,11 @@ steps: COMPOSE_PROJECT_NAME: detections-e2e commands: - cd e2e - - mkdir -p results logs + - mkdir -p fixtures results logs + - if [ -d fixtures/classes.json ]; then rm -rf fixtures/classes.json; fi + - if [ ! -f fixtures/classes.json ] && [ -f ../classes.json ]; then cp ../classes.json fixtures/classes.json; fi + - test -f fixtures/classes.json + - docker compose -f docker-compose.test.yml --profile cpu down -v --remove-orphans || true - docker compose -f docker-compose.test.yml --profile cpu up --build --abort-on-container-exit --exit-code-from e2e-runner volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/e2e/docker-compose.test.yml b/e2e/docker-compose.test.yml index f2da6d8..426abf3 100644 --- a/e2e/docker-compose.test.yml +++ b/e2e/docker-compose.test.yml @@ -26,7 +26,7 @@ services: LOADER_URL: http://mock-loader:8080 ANNOTATIONS_URL: http://mock-annotations:8081 JWT_SECRET: test-secret-e2e-only - CLASSES_JSON_PATH: /media/classes.json + CLASSES_JSON_PATH: /app/classes.json volumes: - ./fixtures:/media - ./logs:/app/Logs @@ -49,7 +49,7 @@ services: LOADER_URL: http://mock-loader:8080 ANNOTATIONS_URL: http://mock-annotations:8081 JWT_SECRET: test-secret-e2e-only - CLASSES_JSON_PATH: /media/classes.json + CLASSES_JSON_PATH: /app/classes.json volumes: - ./fixtures:/media - ./logs:/app/Logs @@ -72,7 +72,7 @@ services: LOADER_URL: http://mock-loader:8080 ANNOTATIONS_URL: http://mock-annotations:8081 JWT_SECRET: test-secret-e2e-only - CLASSES_JSON_PATH: /media/classes.json + CLASSES_JSON_PATH: /app/classes.json volumes: - ./fixtures:/media:ro shm_size: 512m diff --git a/e2e/run_test.sh b/e2e/run_test.sh index 8f68b0a..9d312d2 100755 --- a/e2e/run_test.sh +++ b/e2e/run_test.sh @@ -20,6 +20,18 @@ esac COMPOSE="docker compose -f docker-compose.test.yml --profile $PROFILE" LOG_TAIL="${E2E_LOG_TAIL:-100}" + +if [[ -d fixtures/classes.json ]]; then + rm -rf fixtures/classes.json +fi +if [[ ! -f fixtures/classes.json && -f ../classes.json ]]; then + cp ../classes.json fixtures/classes.json +fi +if [[ ! -f fixtures/classes.json ]]; then + echo "ERROR: e2e/fixtures/classes.json is missing" + exit 1 +fi + RUNNER_ENV_ARGS=(-e E2E_PROFILE="$PROFILE") if [[ "$PROFILE" == "jetson" ]]; then RUNNER_ENV_ARGS+=( @@ -45,6 +57,7 @@ usage() { [[ $# -lt 1 ]] && usage +$COMPOSE down -v --remove-orphans || true $COMPOSE up -d --build "$DETECTIONS_SERVICE" echo "--- Waiting for detections service to become healthy..." for i in $(seq 1 60); do