mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
* [WIP] restore 100_make_overleaf_data_dirs.sh * [WIP] patch for hotfix 5.5.5 * Revert "[WIP] patch for hotfix 5.5.5" This reverts commit cc83a526ecd86ed7b1a0e061b074d2fb15d4d672. * Revert "[WIP] restore 100_make_overleaf_data_dirs.sh" This reverts commit e9b0597fe8451e9ef1deaf7ed31790f7d7fc996e. * [server-pro] extend hotfix 5.5.5: avoid creating user_files directory * [server-ce] run binary files migration in CI GitOrigin-RevId: ac5bb86df92b441201c69dfac6b302058b501d8e
115 lines
2.5 KiB
TypeScript
115 lines
2.5 KiB
TypeScript
import { reconfigure } from './hostAdminClient'
|
|
import { resetActivateUserRateLimit, resetCreatedUsersCache } from './login'
|
|
|
|
export const STARTUP_TIMEOUT =
|
|
parseInt(Cypress.env('STARTUP_TIMEOUT'), 10) || 120_000
|
|
|
|
export function isExcludedBySharding(
|
|
shard:
|
|
| 'LOCAL_ONLY'
|
|
| 'CE_DEFAULT'
|
|
| 'CE_CUSTOM_1'
|
|
| 'PRO_DEFAULT_1'
|
|
| 'PRO_DEFAULT_2'
|
|
| 'PRO_CUSTOM_1'
|
|
| 'PRO_CUSTOM_2'
|
|
| 'PRO_CUSTOM_3'
|
|
| 'PRO_CUSTOM_4'
|
|
| 'PRO_CUSTOM_5'
|
|
) {
|
|
const SHARD = Cypress.env('SHARD')
|
|
return SHARD && shard !== SHARD
|
|
}
|
|
|
|
let previousConfigFrontend: string
|
|
|
|
export function startWith({
|
|
pro = false,
|
|
version = 'latest',
|
|
vars = {},
|
|
varsFn = () => ({}),
|
|
withDataDir = false,
|
|
resetData = false,
|
|
mongoVersion = '',
|
|
}) {
|
|
before(async function () {
|
|
Object.assign(vars, varsFn())
|
|
const cfg = JSON.stringify({
|
|
pro,
|
|
version,
|
|
vars,
|
|
withDataDir,
|
|
resetData,
|
|
mongoVersion,
|
|
})
|
|
if (resetData) {
|
|
cy.log('resetting data and sessions')
|
|
resetCreatedUsersCache()
|
|
resetActivateUserRateLimit()
|
|
// no return here, always reconfigure when resetting data
|
|
} else if (previousConfigFrontend === cfg) {
|
|
cy.log(`already running with ${cfg}`)
|
|
return
|
|
}
|
|
cy.log(`starting with ${cfg}`)
|
|
|
|
this.timeout(STARTUP_TIMEOUT)
|
|
previousConfigFrontend = ''
|
|
const { previousConfigServer } = await reconfigure({
|
|
pro,
|
|
version,
|
|
vars,
|
|
withDataDir,
|
|
resetData,
|
|
mongoVersion,
|
|
})
|
|
if (previousConfigServer !== cfg) {
|
|
await Cypress.session.clearAllSavedSessions()
|
|
}
|
|
previousConfigFrontend = cfg
|
|
})
|
|
}
|
|
|
|
// Allow reloading the server in other places, e.g. beforeEach hooks.
|
|
export async function reloadWith({
|
|
pro = false,
|
|
version = 'latest',
|
|
vars = {},
|
|
varsFn = () => ({}),
|
|
withDataDir = false,
|
|
resetData = false,
|
|
mongoVersion = '',
|
|
}) {
|
|
Object.assign(vars, varsFn())
|
|
const cfg = JSON.stringify({
|
|
pro,
|
|
version,
|
|
vars,
|
|
withDataDir,
|
|
resetData,
|
|
mongoVersion,
|
|
})
|
|
if (resetData) {
|
|
resetCreatedUsersCache()
|
|
resetActivateUserRateLimit()
|
|
// no return here, always reconfigure when resetting data
|
|
} else if (previousConfigFrontend === cfg) {
|
|
return
|
|
}
|
|
previousConfigFrontend = ''
|
|
const { previousConfigServer } = await reconfigure({
|
|
pro,
|
|
version,
|
|
vars,
|
|
withDataDir,
|
|
resetData,
|
|
mongoVersion,
|
|
})
|
|
if (previousConfigServer !== cfg) {
|
|
await Cypress.session.clearAllSavedSessions()
|
|
}
|
|
previousConfigFrontend = cfg
|
|
}
|
|
|
|
export { reconfigure }
|