Fix port conflict: use port 27018 for test MongoDB
Some checks failed
CI/CD Pipeline - Apartment API / Run Tests (push) Successful in 9m47s
CI/CD Pipeline - Apartment API / Build & Push Image (push) Failing after 1m24s
CI/CD Pipeline - Apartment API / Deploy to Production (push) Has been skipped

Host machine already has MongoDB on 27017, so map the test
container to 27018 instead to avoid port allocation conflict.
This commit is contained in:
2026-01-22 15:43:04 -07:00
parent 47743656e2
commit cbb5c1ce48

View File

@ -23,7 +23,7 @@ jobs:
mongodb: mongodb:
image: mongo:7 image: mongo:7
ports: ports:
- 27017:27017 - 27018:27017
options: >- options: >-
--health-cmd "mongosh --eval 'db.runCommand(\"ping\").ok'" --health-cmd "mongosh --eval 'db.runCommand(\"ping\").ok'"
--health-interval 10s --health-interval 10s
@ -46,7 +46,7 @@ jobs:
- name: Run tests - name: Run tests
run: npm test -- --runInBand run: npm test -- --runInBand
env: env:
MONGO_URI: mongodb://localhost:27017 MONGO_URI: mongodb://localhost:27018
JWT_SECRET: test-jwt-secret-for-ci JWT_SECRET: test-jwt-secret-for-ci
NODE_ENV: test NODE_ENV: test