Parcourir la source

test: Docker backend tests get the frontend sources, scripts/, pkill and an init process

maziggy il y a 4 jours
Parent
commit
3ffa88afae
2 fichiers modifiés avec 11 ajouts et 0 suppressions
  1. 2 0
      Dockerfile.test
  2. 9 0
      docker-compose.test.yml

+ 2 - 0
Dockerfile.test

@@ -5,8 +5,10 @@ FROM python:3.13-slim AS backend-test
 WORKDIR /app
 
 # Install system dependencies for testing
+# procps: pkill, which a camera test uses to clean up its fake ffmpeg.
 RUN apt-get update && apt-get install -y --no-install-recommends \
     curl \
+    procps \
     && rm -rf /var/lib/apt/lists/*
 
 # Install Python dependencies including test dependencies.

+ 9 - 0
docker-compose.test.yml

@@ -6,8 +6,14 @@ services:
       dockerfile: Dockerfile.test
       target: backend-test
     container_name: bambuddy-backend-test
+    # Reaps orphaned processes: pytest would otherwise be PID 1 and leave the
+    # children some tests kill as zombies that still answer kill(pid, 0).
+    init: true
+    # Some backend tests also read the frontend sources and scripts/.
     volumes:
       - ./backend:/app/backend:ro
+      - ./frontend/src:/app/frontend/src:ro
+      - ./scripts:/app/scripts:ro
     environment:
       - TESTING=1
       - PYTHONUNBUFFERED=1
@@ -59,8 +65,11 @@ services:
     # -v dropped + -n auto so integration tests inherit the same noise /
     # parallelism profile as the backend-test image (see Dockerfile.test CMD).
     command: ["pytest", "backend/tests/integration/", "--tb=short", "-p", "no:cacheprovider", "-n", "auto"]
+    init: true
     volumes:
       - ./backend:/app/backend:ro
+      - ./frontend/src:/app/frontend/src:ro
+      - ./scripts:/app/scripts:ro
 
 volumes:
   integration_test_data: