Explorar o código

test: Docker test runs use 30 workers (-n auto counted physical cores only); tests stop the background tasks they started and close the app engine's connections after every test on SQLite too ("Event loop is closed" thread warning)

maziggy hai 1 día
pai
achega
9083cd2a35
Modificáronse 2 ficheiros con 6 adicións e 7 borrados
  1. 4 5
      Dockerfile.test
  2. 2 2
      docker-compose.test.yml

+ 4 - 5
Dockerfile.test

@@ -46,11 +46,10 @@ HEALTHCHECK NONE
 # -v dropped: 5300+ "PASSED foo::bar" lines per worker eat noticeable
 # stdout I/O time and clutter test_docker.sh output. --tb=short still
 # gives full failure tracebacks when something breaks.
-# -n logical adapts to the host's vCPU count instead of hard-coding 30 —
-# on a 2-vCPU CI / VM runner, -n 30 spawns 30 Python processes fighting
-# for 2 cores, which is mostly IPC + import-thrash overhead. Not -n auto:
-# with psutil installed that counts physical cores only (16 of 30 here).
-CMD ["pytest", "backend/tests/", "--tb=short", "-p", "no:cacheprovider", "-n", "logical"]
+# -n 30: the test host's worker count. Not -n auto (with psutil installed
+# that counts physical cores only, 16) nor -n logical (the Docker host's 32
+# CPUs, more than this machine is meant to use).
+CMD ["pytest", "backend/tests/", "--tb=short", "-p", "no:cacheprovider", "-n", "30"]
 
 # -------------------------------------------
 # Frontend test stage

+ 2 - 2
docker-compose.test.yml

@@ -62,9 +62,9 @@ services:
     environment:
       - BAMBUDDY_TEST_URL=http://integration:8000
       - TESTING=1
-    # -v dropped + -n logical so integration tests inherit the same noise /
+    # -v dropped + -n 30 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", "logical"]
+    command: ["pytest", "backend/tests/integration/", "--tb=short", "-p", "no:cacheprovider", "-n", "30"]
     init: true
     volumes:
       - ./backend:/app/backend:ro