Merge pull request #27936 from overleaf/em-unit-tests-mongo

Make Mongo available to unit tests in all services

GitOrigin-RevId: b65bbb69883d5bba31d09802b89f35bdc523fe4d
This commit is contained in:
Eric Mc Sween
2025-08-22 08:15:20 -04:00
committed by Copybot
parent 7dc7b322a8
commit 8f0913fafe
57 changed files with 404 additions and 162 deletions

View File

@@ -9,14 +9,26 @@ services:
- .:/overleaf/services/project-history
- ../../node_modules:/overleaf/node_modules
- ../../libraries:/overleaf/libraries
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
working_dir: /overleaf/services/project-history
environment:
MOCHA_GREP: ${MOCHA_GREP}
LOG_LEVEL: ${LOG_LEVEL:-}
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
REDIS_HOST: redis_test
HISTORY_REDIS_HOST: redis_test
QUEUES_REDIS_HOST: redis_test
ANALYTICS_QUEUES_REDIS_HOST: redis_test
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
command: npm run --silent test:unit
user: node
depends_on:
mongo:
condition: service_started
redis_test:
condition: service_healthy
test_acceptance:
image: node:22.18.0
@@ -28,10 +40,10 @@ services:
working_dir: /overleaf/services/project-history
environment:
ELASTIC_SEARCH_DSN: es:9200
REDIS_HOST: redis
HISTORY_REDIS_HOST: redis
QUEUES_REDIS_HOST: redis
ANALYTICS_QUEUES_REDIS_HOST: redis
REDIS_HOST: redis_test
HISTORY_REDIS_HOST: redis_test
QUEUES_REDIS_HOST: redis_test
ANALYTICS_QUEUES_REDIS_HOST: redis_test
MONGO_HOST: mongo
POSTGRES_HOST: postgres
MOCHA_GREP: ${MOCHA_GREP}
@@ -42,12 +54,12 @@ services:
depends_on:
mongo:
condition: service_started
redis:
redis_test:
condition: service_healthy
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
command: npm run --silent test:acceptance
redis:
redis_test:
image: redis:7.4.3
healthcheck:
test: ping=$$(redis-cli ping) && [ "$$ping" = 'PONG' ]