2024-05-30 03:12:56 -04:00
|
|
|
import { reconfigure } from './hostAdminClient'
|
2024-07-10 10:00:41 -04:00
|
|
|
import { resetCreatedUsersCache } from './login'
|
2024-05-30 03:12:56 -04:00
|
|
|
|
2024-06-25 07:03:05 -04:00
|
|
|
export const STARTUP_TIMEOUT =
|
|
|
|
parseInt(Cypress.env('STARTUP_TIMEOUT'), 10) || 120_000
|
|
|
|
|
2024-07-10 10:00:41 -04:00
|
|
|
export function isExcludedBySharding(
|
|
|
|
shard:
|
|
|
|
| 'CE_DEFAULT'
|
|
|
|
| 'CE_CUSTOM_1'
|
|
|
|
| 'CE_CUSTOM_2'
|
|
|
|
| 'PRO_DEFAULT_1'
|
|
|
|
| 'PRO_DEFAULT_2'
|
|
|
|
| 'PRO_CUSTOM_1'
|
|
|
|
| 'PRO_CUSTOM_2'
|
|
|
|
| 'PRO_CUSTOM_3'
|
|
|
|
) {
|
|
|
|
const SHARD = Cypress.env('SHARD')
|
|
|
|
return SHARD && shard !== SHARD
|
|
|
|
}
|
|
|
|
|
2024-05-30 03:12:56 -04:00
|
|
|
let lastConfig: string
|
|
|
|
|
2024-05-30 03:13:40 -04:00
|
|
|
export function startWith({
|
|
|
|
pro = false,
|
|
|
|
version = 'latest',
|
|
|
|
vars = {},
|
|
|
|
varsFn = () => ({}),
|
2024-06-11 07:01:21 -04:00
|
|
|
withDataDir = false,
|
2024-07-10 10:00:41 -04:00
|
|
|
resetData = false,
|
2024-05-30 03:13:40 -04:00
|
|
|
}) {
|
2024-05-30 03:12:56 -04:00
|
|
|
before(async function () {
|
2024-05-30 03:13:40 -04:00
|
|
|
Object.assign(vars, varsFn())
|
2024-07-01 11:02:37 -04:00
|
|
|
const cfg = JSON.stringify({
|
|
|
|
pro,
|
|
|
|
version,
|
|
|
|
vars,
|
|
|
|
withDataDir,
|
|
|
|
})
|
2024-07-10 10:00:41 -04:00
|
|
|
if (resetData) {
|
|
|
|
resetCreatedUsersCache()
|
|
|
|
// no return here, always reconfigure when resetting data
|
|
|
|
} else if (lastConfig === cfg) {
|
|
|
|
return
|
|
|
|
}
|
2024-05-30 03:12:56 -04:00
|
|
|
|
2024-06-25 07:03:05 -04:00
|
|
|
this.timeout(STARTUP_TIMEOUT)
|
2024-07-10 10:00:41 -04:00
|
|
|
await reconfigure({ pro, version, vars, withDataDir, resetData })
|
2024-05-30 03:12:56 -04:00
|
|
|
lastConfig = cfg
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export { reconfigure }
|