From ed905d8406841c5a6e53181a8668d77241922a88 Mon Sep 17 00:00:00 2001 From: maziggy Date: Sun, 24 May 2026 13:19:55 +0200 Subject: [PATCH] ci(docker): stop re-running unit tests inside the test image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- .github/workflows/ci.yml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fc9a05f1..03e202eae 100644 --- a/.github/workflows/ci.yml +++ b/.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