overleaf/server-ce/test/helpers/config.ts
Jakob Ackermann ce9b531892 Merge pull request #19098 from overleaf/jpa-graceful-shutdown-tests
[server-ce] add test for graceful shutdown

GitOrigin-RevId: 5e72e0073169009d2e3ece5a79cbd62051f6ad5b
2024-06-25 11:12:43 +00:00

26 lines
604 B
TypeScript

import { reconfigure } from './hostAdminClient'
export const STARTUP_TIMEOUT =
parseInt(Cypress.env('STARTUP_TIMEOUT'), 10) || 120_000
let lastConfig: string
export function startWith({
pro = false,
version = 'latest',
vars = {},
varsFn = () => ({}),
withDataDir = false,
}) {
before(async function () {
Object.assign(vars, varsFn())
const cfg = JSON.stringify({ pro, version, vars, withDataDir })
if (lastConfig === cfg) return
this.timeout(STARTUP_TIMEOUT)
await reconfigure({ pro, version, vars, withDataDir })
lastConfig = cfg
})
}
export { reconfigure }