Merge pull request #12814 from overleaf/jpa-modules-rs-init

[web] initialize mongo replicaset for individual modules

GitOrigin-RevId: 9f8934ae58b21a99f466093617449f5e792d39cd
This commit is contained in:
Jakob Ackermann 2023-04-26 13:11:55 +01:00 committed by Copybot
parent cd689e4e1f
commit 46fb6f7c83
2 changed files with 12 additions and 0 deletions

View file

@ -170,6 +170,7 @@ test_frontend_ct_modules:
# Acceptance tests
#
# Keep in sync with TEST_ACCEPTANCE_MONGO_INIT in Makefile.module
TEST_ACCEPTANCE_MONGO_INIT := \
$(DOCKER_COMPOSE) up -d mongo; \
$(DOCKER_COMPOSE) exec -T mongo sh -c ' \

View file

@ -27,6 +27,16 @@ DOCKER_COMPOSE_TEST_UNIT := \
export COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME)_$(MODULE_NAME) \
&& $(DOCKER_COMPOSE)
# Keep in sync with TEST_ACCEPTANCE_MONGO_INIT in Makefile
TEST_ACCEPTANCE_MONGO_INIT := \
$(DOCKER_COMPOSE_TEST_ACCEPTANCE) up -d mongo; \
$(DOCKER_COMPOSE_TEST_ACCEPTANCE) exec -T mongo sh -c ' \
while ! mongo --eval "db.version()" > /dev/null; do \
echo "Waiting for Mongo..."; \
sleep 1; \
done; \
mongo --eval "rs.initiate({ _id: \"overleaf\", members: [ { _id: 0, host: \"mongo:27017\" } ] })"'
ifeq (,$(wildcard test/unit))
test_unit:
@ -58,6 +68,7 @@ test_acceptance_server_pro: export BASE_CONFIG = $(CFG_SERVER_PRO)
$(ALL_TEST_ACCEPTANCE_VARIANTS):
$(MAKE) --no-print-directory clean_test_acceptance
$(TEST_ACCEPTANCE_MONGO_INIT)
${DOCKER_COMPOSE_TEST_ACCEPTANCE} run --rm test_acceptance npm -q run test:acceptance:run_dir -- ${MOCHA_ARGS} $(MODULE_DIR)/test/acceptance/src
$(MAKE) --no-print-directory clean_test_acceptance