Browse Source

ci(docker): stop re-running unit tests inside the test image

  The "Docker Build" job in ci.yml was running the same 5287 backend
  tests + 2022 frontend tests inside the bambuddy-backend-test /
  bambuddy-frontend-test images that the host-side backend-tests and
  frontend-tests jobs had already run. Same test code, same Python
  version (env.PYTHON_VERSION), same requirements.txt the test image
  installs. On 2-vCPU GHA runners that re-run added 5-10 min of
  wall-clock for zero new coverage — and "frontend tests in Docker"
  added another 2-3 min for the same reason.

  Drop both steps from the CI job. Keep everything that validates the
  Docker IMAGE specifically: production image build, backend module
  import verification, static-files-copied check, integration
  container bring-up + health/API/static HTTP smoke checks, and the
  integration test suite (which IS genuinely Docker-specific — it
  runs against the live container via BAMBUDDY_TEST_URL).

  test_docker.sh keeps the unit-test reruns because devs running it
  locally don't have a separate host-side pytest job to compare
  against.

  Combined with the earlier 4-way pytest-split shard on the host
  backend-tests job, expected PR-push wall-clock drops from
  ~10-12 min to ~3 min, gated on max(backend-tests shard, frontend
  tests, docker-image-build+integration).
maziggy 3 days ago
parent
commit
1b271a8ead
1 changed files with 12 additions and 13 deletions
  1. 12 13
      .github/workflows/ci.yml

+ 12 - 13
.github/workflows/ci.yml

@@ -298,19 +298,18 @@ jobs:
       - name: Verify static files exist
         run: docker run --rm bambuddy:test test -d /app/static
 
-      # Test 2: Backend Unit Tests in Docker
-      - name: Build backend test image
-        run: docker compose -f docker-compose.test.yml build backend-test
-
-      - name: Run backend tests in Docker
-        run: docker compose -f docker-compose.test.yml run --rm backend-test
-
-      # Test 3: Frontend Unit Tests in Docker
-      - name: Build frontend test image
-        run: docker compose -f docker-compose.test.yml build frontend-test
-
-      - name: Run frontend tests in Docker
-        run: docker compose -f docker-compose.test.yml run --rm frontend-test
+      # NOTE: Tests 2 and 3 from test_docker.sh (backend / frontend unit
+      # tests inside the test image) used to run here. They've been removed
+      # from the CI pipeline because the host-side `backend-tests` and
+      # `frontend-tests` jobs already exercise the exact same test code
+      # against the exact same Python version + requirements.txt the test
+      # image installs — on 2-vCPU GHA runners a re-run inside Docker
+      # added 5-10 min of wall-clock for zero new coverage. The
+      # image-validation purpose of this job (does it build, do imports
+      # resolve, does the integration container come up and answer HTTP)
+      # lives in the surrounding steps. test_docker.sh keeps the unit-test
+      # runs because devs running it locally don't have a separate host-
+      # side pytest job to compare against.
 
       # Test 4: Integration Tests
       - name: Build integration container