[web] override timeout for a specific template (#30711)

* [web] override timeout for a specific template

* [web] fix junit integration for vitest

* [web] consolidate on JUNIT_ROOT_SUITE_NAME

* [web] fix unit test

GitOrigin-RevId: 3ba865e4b9c090c7bf8e07dc3d81e9bcee20d821
This commit is contained in:
Jakob Ackermann
2026-01-15 12:01:06 +00:00
committed by Copybot
parent 95f0dac343
commit 14a7e935b8
8 changed files with 32 additions and 27 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
let reporterOptions = {}
if (process.env.CI && process.env.MOCHA_ROOT_SUITE_NAME) {
if (process.env.CI && process.env.JUNIT_ROOT_SUITE_NAME) {
reporterOptions = {
reporter: '/overleaf/node_modules/mocha-multi-reporters',
'reporter-options': ['configFile=./test/mocha-multi-reporters.js'],
+11 -11
View File
@@ -107,12 +107,12 @@ test_unit_app: export COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME)
test_unit_app: mongo_migrations_for_tests
$(DOCKER_COMPOSE) run --name unit_test_$(BUILD_DIR_NAME) --rm test_unit
test_unit_parallel: export VITEST_ROOT_SUITE_NAME = ESM unit tests - parallel
test_unit_parallel: export JUNIT_ROOT_SUITE_NAME = ESM unit tests - parallel
test_unit_parallel: export COMPOSE_PROJECT_NAME=unit_test_parallel_$(BUILD_DIR_NAME)
test_unit_parallel: mongo_migrations_for_tests
$(DOCKER_COMPOSE) run --rm test_unit npm run test:unit:parallel
test_unit_sequential: export VITEST_ROOT_SUITE_NAME = ESM unit tests - sequential
test_unit_sequential: export JUNIT_ROOT_SUITE_NAME = ESM unit tests - sequential
test_unit_sequential: export COMPOSE_PROJECT_NAME=unit_test_sequential_$(BUILD_DIR_NAME)
test_unit_sequential: mongo_migrations_for_tests
$(DOCKER_COMPOSE) run --rm test_unit npm run test:unit:sequential
@@ -159,7 +159,7 @@ mongo_migrations_for_tests:
# Frontend tests
#
test_frontend: export MOCHA_ROOT_SUITE_NAME = JSDOM frontend tests
test_frontend: export JUNIT_ROOT_SUITE_NAME = JSDOM frontend tests
test_frontend:
COMPOSE_PROJECT_NAME=frontend_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --rm test_frontend
COMPOSE_PROJECT_NAME=frontend_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
@@ -181,7 +181,7 @@ TEST_FRONTEND_CT_VARIANTS = \
# Writefull tests
#
test_writefull: export MOCHA_ROOT_SUITE_NAME = Writefull tests
test_writefull: export JUNIT_ROOT_SUITE_NAME = Writefull tests
test_writefull:
COMPOSE_PROJECT_NAME=writefull_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) run --rm test_writefull
COMPOSE_PROJECT_NAME=writefull_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down -v -t 0
@@ -232,13 +232,13 @@ TEST_ACCEPTANCE_APP := \
test_acceptance_app_server_pro \
test_acceptance_app: $(TEST_ACCEPTANCE_APP)
test_acceptance_app_saas: export MOCHA_ROOT_SUITE_NAME = SaaS app acceptance tests
test_acceptance_app_saas: export JUNIT_ROOT_SUITE_NAME = SaaS app acceptance tests
test_acceptance_app_saas: export COMPOSE_PROJECT_NAME=acceptance_test_saas_$(BUILD_DIR_NAME)
test_acceptance_app_saas: export OVERLEAF_CONFIG=$(CFG_SAAS)
test_acceptance_app_server_ce: export MOCHA_ROOT_SUITE_NAME = Server CE app acceptance tests
test_acceptance_app_server_ce: export JUNIT_ROOT_SUITE_NAME = Server CE app acceptance tests
test_acceptance_app_server_ce: export COMPOSE_PROJECT_NAME=acceptance_test_server_ce_$(BUILD_DIR_NAME)
test_acceptance_app_server_ce: export OVERLEAF_CONFIG=$(CFG_SERVER_CE)
test_acceptance_app_server_pro: export MOCHA_ROOT_SUITE_NAME = Server Pro app acceptance tests
test_acceptance_app_server_pro: export JUNIT_ROOT_SUITE_NAME = Server Pro app acceptance tests
test_acceptance_app_server_pro: export COMPOSE_PROJECT_NAME=acceptance_test_server_pro_$(BUILD_DIR_NAME)
test_acceptance_app_server_pro: export OVERLEAF_CONFIG=$(CFG_SERVER_PRO)
@@ -370,17 +370,17 @@ $(TEST_ACCEPTANCE_MODULES_MERGED_INNER_SPLIT):
)
# See docs for test_acceptance_server_ce how this works.
test_acceptance_modules_merged_saas: export MOCHA_ROOT_SUITE_NAME = SaaS modules acceptance tests
test_acceptance_modules_merged_saas: export JUNIT_ROOT_SUITE_NAME = SaaS modules acceptance tests
test_acceptance_modules_merged_saas: export COMPOSE_PROJECT_NAME = \
acceptance_test_modules_merged_saas_$(BUILD_DIR_NAME)
test_acceptance_modules_merged_saas: export BASE_CONFIG = $(CFG_SAAS)
test_acceptance_modules_merged_server_ce: export MOCHA_ROOT_SUITE_NAME = Server CE modules acceptance tests
test_acceptance_modules_merged_server_ce: export JUNIT_ROOT_SUITE_NAME = Server CE modules acceptance tests
test_acceptance_modules_merged_server_ce: export COMPOSE_PROJECT_NAME = \
acceptance_test_modules_merged_server_ce_$(BUILD_DIR_NAME)
test_acceptance_modules_merged_server_ce: export BASE_CONFIG = $(CFG_SERVER_CE)
test_acceptance_modules_merged_server_pro: export MOCHA_ROOT_SUITE_NAME = Server Pro modules acceptance tests
test_acceptance_modules_merged_server_pro: export JUNIT_ROOT_SUITE_NAME = Server Pro modules acceptance tests
test_acceptance_modules_merged_server_pro: export COMPOSE_PROJECT_NAME = \
acceptance_test_modules_merged_server_pro_$(BUILD_DIR_NAME)
test_acceptance_modules_merged_server_pro: export BASE_CONFIG = $(CFG_SERVER_PRO)
@@ -412,7 +412,7 @@ test_acceptance_modules_merged_saas_3: export COMPOSE_PROJECT_NAME = \
test_acceptance_modules_merged_saas_4: export COMPOSE_PROJECT_NAME = \
acceptance_test_modules_merged_saas_4_$(BUILD_DIR_NAME)
$(TEST_ACCEPTANCE_MODULES_MERGED_SPLIT_SAAS): export BASE_CONFIG = $(CFG_SAAS)
$(TEST_ACCEPTANCE_MODULES_MERGED_SPLIT_SAAS): export MOCHA_ROOT_SUITE_NAME = SaaS modules acceptance tests
$(TEST_ACCEPTANCE_MODULES_MERGED_SPLIT_SAAS): export JUNIT_ROOT_SUITE_NAME = SaaS modules acceptance tests
$(TEST_ACCEPTANCE_MODULES_MERGED_SPLIT_SAAS): test_acceptance_modules_merged_saas_%:
$(DOCKER_COMPOSE) run --rm test_acceptance make test_acceptance_modules_merged_inner_$*
@@ -105,6 +105,7 @@ const instrumentedCompile = instrumentWithTimer(compile, 'editor.compile')
async function getProjectCompileLimits(projectId) {
const project = await ProjectGetter.promises.getProject(projectId, {
owner_ref: 1,
fromV1TemplateId: 1,
})
return _getProjectCompileLimits(project)
}
@@ -138,6 +139,9 @@ async function _getProjectCompileLimits(project) {
compileBackendClass: compileGroup === 'standard' ? 'c3d' : 'c4d',
ownerAnalyticsId: analyticsId,
}
if (project.fromV1TemplateId === Settings.overrideCompileTimeForTemplate) {
limits.timeout = Math.max(limits.timeout, 20)
}
return limits
}
@@ -161,6 +165,7 @@ async function syncTeX(
const project = await ProjectGetter.promises.getProject(projectId, {
owner_ref: 1,
imageName: 1,
fromV1TemplateId: 1,
})
const limits = await _getProjectCompileLimits(project)
const { imageName } = project
+4 -4
View File
@@ -21,7 +21,7 @@ services:
environment:
CI:
MODULE_NAME:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
BASE_CONFIG:
OVERLEAF_CONFIG:
NODE_ENV: test
@@ -44,7 +44,7 @@ services:
environment:
CI:
MODULE_NAME:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
BASE_CONFIG:
OVERLEAF_CONFIG:
REDIS_HOST: redis_test
@@ -79,7 +79,7 @@ services:
environment:
NODE_OPTIONS: "--unhandled-rejections=strict"
CI:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
test_frontend_ct:
image: cypress/included:13.13.2
@@ -115,7 +115,7 @@ services:
- ./data/reports:/overleaf/services/web/data/reports
environment:
CI:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
NODE_OPTIONS: "--unhandled-rejections=strict"
tar:
+5 -5
View File
@@ -18,7 +18,7 @@ services:
OVERLEAF_CONFIG:
CI:
MODULE_NAME:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
MOCHA_GREP: ${MOCHA_GREP}
LOG_LEVEL: ${LOG_LEVEL:-}
NODE_ENV: test
@@ -47,7 +47,7 @@ services:
OVERLEAF_CONFIG:
CI:
MODULE_NAME:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
MOCHA_GREP: ${MOCHA_GREP}
LOG_LEVEL: ${LOG_LEVEL:-}
MONGO_SERVER_SELECTION_TIMEOUT: 600000
@@ -77,7 +77,7 @@ services:
working_dir: /overleaf/services/web
environment:
CI:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
MOCHA_GREP: ${MOCHA_GREP}
NODE_OPTIONS: "--unhandled-rejections=strict"
VERBOSE_LOGGING:
@@ -93,7 +93,7 @@ services:
environment:
VERBOSE_LOGGING:
CI:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
CYPRESS_SPEC_PATTERN: ${CYPRESS_SPEC_PATTERN:-}
CYPRESS_EXCLUDE_SPEC_PATTERN: ${CYPRESS_EXCLUDE_SPEC_PATTERN:-}
entrypoint: npm
@@ -113,7 +113,7 @@ services:
working_dir: /overleaf/services/web
environment:
CI:
MOCHA_ROOT_SUITE_NAME:
JUNIT_ROOT_SUITE_NAME:
NODE_OPTIONS: "--unhandled-rejections=strict"
VERBOSE_LOGGING:
command: npm run --silent test:writefull
+3 -3
View File
@@ -1,11 +1,11 @@
module.exports = {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: `data/reports/junit-mocha-${process.env.MOCHA_ROOT_SUITE_NAME}-${process.env.MODULE_NAME}.xml`,
mochaFile: `data/reports/junit-mocha-${process.env.JUNIT_ROOT_SUITE_NAME}-${process.env.MODULE_NAME}.xml`,
includePending: true,
jenkinsMode: true,
jenkinsClassnamePrefix: process.env.MOCHA_ROOT_SUITE_NAME,
rootSuiteTitle: process.env.MOCHA_ROOT_SUITE_NAME,
jenkinsClassnamePrefix: process.env.JUNIT_ROOT_SUITE_NAME,
rootSuiteTitle: process.env.JUNIT_ROOT_SUITE_NAME,
outputs: true,
},
}
@@ -233,7 +233,7 @@ describe('CompileManager', function () {
it('should look up the owner of the project', function (ctx) {
ctx.ProjectGetter.promises.getProject
.calledWith(ctx.project_id, { owner_ref: 1 })
.calledWith(ctx.project_id, { owner_ref: 1, fromV1TemplateId: 1 })
.should.equal(true)
})
+2 -2
View File
@@ -1,14 +1,14 @@
const { defineConfig } = require('vitest/config')
let reporterOptions = {}
if (process.env.CI && process.env.MOCHA_ROOT_SUITE_NAME) {
if (process.env.CI && process.env.JUNIT_ROOT_SUITE_NAME) {
reporterOptions = {
reporters: [
'default',
[
'junit',
{
classnameTemplate: `${process.env.MOCHA_ROOT_SUITE_NAME}.{filename}`,
classnameTemplate: `${process.env.JUNIT_ROOT_SUITE_NAME}.{filename}`,
},
],
],