mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #4016 from overleaf/jpa-faster-ci-4288
[perf] faster CI GitOrigin-RevId: 858c0c4947e41961dae35cb20e0fcc2e2f723787
This commit is contained in:
parent
01c8a8a04d
commit
1d95137e13
8 changed files with 56 additions and 3 deletions
|
@ -141,6 +141,30 @@ clean_ci: clean_test_acceptance_modules
|
|||
test_acceptance_module:
|
||||
$(MAKE) modules/$(MODULE_NAME)/test_acceptance
|
||||
|
||||
TEST_ACCEPTANCE_MODULES_MERGED_INNER = $(MODULE_DIRS:=/test_acceptance_merged_inner)
|
||||
$(TEST_ACCEPTANCE_MODULES_MERGED_INNER): %/test_acceptance_merged_inner: %/Makefile
|
||||
test_acceptance_modules_merged_inner: $(TEST_ACCEPTANCE_MODULES_MERGED_INNER)
|
||||
|
||||
test_acceptance_modules_merged: export COMPOSE_PROJECT_NAME = \
|
||||
acceptance_test_modules_merged_$(BUILD_DIR_NAME)
|
||||
test_acceptance_modules_merged:
|
||||
$(DOCKER_COMPOSE) down -v -t 0
|
||||
$(DOCKER_COMPOSE) run --rm test_acceptance make test_acceptance_modules_merged_inner
|
||||
$(DOCKER_COMPOSE) down -v -t 0
|
||||
|
||||
test_acceptance_app_merged_inner:
|
||||
npm run --silent test:acceptance:app
|
||||
|
||||
test_acceptance_merged_inner: test_acceptance_app_merged_inner
|
||||
test_acceptance_merged_inner: test_acceptance_modules_merged_inner
|
||||
|
||||
test_acceptance_merged: export COMPOSE_PROJECT_NAME = \
|
||||
acceptance_test_merged_$(BUILD_DIR_NAME)
|
||||
test_acceptance_merged:
|
||||
$(DOCKER_COMPOSE) down -v -t 0
|
||||
$(DOCKER_COMPOSE) run --rm test_acceptance make test_acceptance_merged_inner
|
||||
$(DOCKER_COMPOSE) down -v -t 0
|
||||
|
||||
#
|
||||
# CI tests
|
||||
#
|
||||
|
@ -307,6 +331,7 @@ tar:
|
|||
|
||||
MODULE_TARGETS = \
|
||||
$(TEST_ACCEPTANCE_MODULES) \
|
||||
$(TEST_ACCEPTANCE_MODULES_MERGED_INNER) \
|
||||
$(CLEAN_TEST_ACCEPTANCE_MODULES) \
|
||||
$(TEST_UNIT_MODULES) \
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ endif
|
|||
|
||||
ifeq (,$(wildcard test/acceptance))
|
||||
test_acceptance:
|
||||
test_acceptance_merged_inner:
|
||||
clean_test_acceptance:
|
||||
|
||||
else
|
||||
|
@ -41,6 +42,11 @@ test_acceptance:
|
|||
${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
|
||||
|
||||
test_acceptance_merged_inner:
|
||||
cd ../../ && \
|
||||
SHARELATEX_CONFIG=/app/$(MODULE_DIR)/test/acceptance/config/settings.test.coffee \
|
||||
npm -q run test:acceptance:run_dir -- ${MOCHA_ARGS} $(MODULE_DIR)/test/acceptance/src
|
||||
|
||||
clean_test_acceptance:
|
||||
${DOCKER_COMPOSE_TEST_ACCEPTANCE} down -v -t 0
|
||||
|
||||
|
|
|
@ -192,3 +192,6 @@ module.exports =
|
|||
|
||||
unsupportedBrowsers:
|
||||
ie: '<=11'
|
||||
|
||||
test:
|
||||
counterInit: 0
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
const App = require('../../../../app.js')
|
||||
const MongoHelper = require('./MongoHelper')
|
||||
const RedisHelper = require('./RedisHelper')
|
||||
const { logger } = require('logger-sharelatex')
|
||||
|
||||
logger.level('error')
|
||||
|
||||
MongoHelper.initialize()
|
||||
RedisHelper.initialize()
|
||||
|
||||
let server
|
||||
|
||||
|
|
|
@ -18,7 +18,13 @@ module.exports = {
|
|||
|
||||
afterEach(async function () {
|
||||
return Promise.all(
|
||||
Object.values(db).map(collection => collection.deleteMany({}))
|
||||
Object.values(db).map(async collection => {
|
||||
if (collection === db.migrations) {
|
||||
// Do not clear the collection for tracking migrations.
|
||||
return
|
||||
}
|
||||
return collection.deleteMany({})
|
||||
})
|
||||
)
|
||||
})
|
||||
},
|
||||
|
|
11
services/web/test/acceptance/src/helpers/RedisHelper.js
Normal file
11
services/web/test/acceptance/src/helpers/RedisHelper.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const RateLimiter = require('../../../../app/src/infrastructure/RateLimiter')
|
||||
|
||||
async function clearOverleafLoginRateLimit() {
|
||||
await RateLimiter.promises.clearRateLimit('overleaf-login', '127.0.0.1')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
initialize() {
|
||||
before(clearOverleafLoginRateLimit)
|
||||
},
|
||||
}
|
|
@ -8,7 +8,7 @@ const { promisify } = require('util')
|
|||
const fs = require('fs')
|
||||
const Path = require('path')
|
||||
|
||||
let count = 0
|
||||
let count = settings.test.counterInit
|
||||
|
||||
class User {
|
||||
constructor(options) {
|
||||
|
|
|
@ -9,7 +9,7 @@ const request = require('request-promise-native')
|
|||
const { db } = require('../../../../app/src/infrastructure/mongodb')
|
||||
const { ObjectId } = require('mongodb')
|
||||
|
||||
let globalUserNum = 1
|
||||
let globalUserNum = Settings.test.counterInit
|
||||
|
||||
class UserHelper {
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue