From b250e908f4ace5ce538610bc2afa69d797fdbe5e Mon Sep 17 00:00:00 2001 From: hided62 Date: Thu, 3 Sep 2026 17:30:24 +0000 Subject: [PATCH] test(clock): add lifecycle deploy checkpoint --- .../scripts/live-ten-user-lifecycle.ts | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/tools/integration-tests/scripts/live-ten-user-lifecycle.ts b/tools/integration-tests/scripts/live-ten-user-lifecycle.ts index 7f12f8e6..d89737ef 100644 --- a/tools/integration-tests/scripts/live-ten-user-lifecycle.ts +++ b/tools/integration-tests/scripts/live-ten-user-lifecycle.ts @@ -27,6 +27,7 @@ type State = { preopenAt: string; openAt: string; resetOperationId: string; + deployOperationId?: string; users?: Array<{ username: string; displayName: string; @@ -189,14 +190,13 @@ const reset = async (): Promise => { }); }; -const waitReset = async (): Promise => { - const state = await readState(); +const waitOperation = async (operationId: string, eventPrefix: string): Promise => { const gateway = await loginAdmin(); let cursor: string | undefined; let lastHeartbeatAt = 0; while (true) { const result = await gateway.admin.operations.logs.query({ - id: state.resetOperationId, + id: operationId, afterCursor: cursor, limit: 200, timeoutMs: 20_000, @@ -205,14 +205,14 @@ const waitReset = async (): Promise => { const notable = result.entries.filter((entry) => entry.level !== 'OUTPUT'); if (notable.length > 0 || Date.now() - lastHeartbeatAt >= 20_000) { lastHeartbeatAt = Date.now(); - log('reset-progress', { + log(`${eventPrefix}-progress`, { status: result.operation.status, receivedLogEntries: result.entries.length, phases: notable.map((entry) => `${entry.level}:${entry.phase}`), }); } if (['SUCCEEDED', 'FAILED', 'CANCELLED'].includes(result.operation.status)) { - log('reset-terminal', { + log(`${eventPrefix}-terminal`, { status: result.operation.status, error: result.operation.error ?? null, completedAt: result.operation.completedAt ?? null, @@ -223,6 +223,31 @@ const waitReset = async (): Promise => { } }; +const waitReset = async (): Promise => { + const state = await readState(); + await waitOperation(state.resetOperationId, 'reset'); +}; + +const deploy = async (): Promise => { + const state = await readState(); + const gateway = await loginAdmin(); + const operation = await gateway.admin.operations.requestDeploy.mutate({ + profileName, + sourceMode: 'BRANCH', + sourceRef, + reason: 'deploy suspended-action lifecycle fixes without resetting the isolated season', + }); + state.deployOperationId = operation.id; + await writeState(state); + log('deploy-requested', { operationId: operation.id, profileName, sourceMode: 'BRANCH', sourceRef }); +}; + +const waitDeploy = async (): Promise => { + const state = await readState(); + if (!state.deployOperationId) throw new Error('No lifecycle deploy operation was requested.'); + await waitOperation(state.deployOperationId, 'deploy'); +}; + const status = async (): Promise => { const gateway = await loginAdmin(); const profiles = (await gateway.admin.profiles.list.query()) as unknown as Array< @@ -2149,6 +2174,8 @@ const monitorUsers = async (): Promise => { const command = process.argv[2]; if (command === 'reset') await reset(); else if (command === 'wait-reset') await waitReset(); +else if (command === 'deploy') await deploy(); +else if (command === 'wait-deploy') await waitDeploy(); else if (command === 'status') await status(); else if (command === 'prepare-users') await prepareUsers(); else if (command === 'preopen-messages') await preopenMessages(); @@ -2181,5 +2208,5 @@ else if (command === 'wait-runtime-action') await waitRuntimeAction(); else if (command === 'monitor-users') await monitorUsers(); else throw new Error( - 'usage: live-ten-user-lifecycle.ts ' + 'usage: live-ten-user-lifecycle.ts ' );