시간 도메인과 정지 중 메시지·베팅 경계 정리
This commit is contained in:
@@ -41,13 +41,16 @@ describeDatabase('gateway release operation persistence', () => {
|
||||
).rejects.toMatchObject({ code: 'P2002' });
|
||||
|
||||
const now = new Date('2030-01-01T00:00:00.000Z');
|
||||
await expect(
|
||||
repository.claimNextOperation(now, { ownerId: 'controller-a', durationMs: 1_000 })
|
||||
).resolves.toMatchObject({
|
||||
const claimed = await repository.claimNextOperation(now, {
|
||||
ownerId: 'controller-a',
|
||||
durationMs: 1_000,
|
||||
});
|
||||
expect(claimed).toMatchObject({
|
||||
id: operation.id,
|
||||
attempts: 1,
|
||||
leaseOwner: 'controller-a',
|
||||
});
|
||||
expect(Date.parse(claimed?.leaseUntil ?? '')).toBeLessThan(Date.now() + 5_000);
|
||||
await expect(repository.pinOperationResolvedCommit(operation.id, 'controller-a', 'a'.repeat(40))).resolves.toBe(
|
||||
true
|
||||
);
|
||||
@@ -103,6 +106,11 @@ describeDatabase('gateway release operation persistence', () => {
|
||||
await repository.claimNextOperation(now, { ownerId: 'controller-a', durationMs: 1_000 });
|
||||
await repository.pinOperationResolvedCommit(operation.id, 'controller-a', 'c'.repeat(40));
|
||||
|
||||
await connector.prisma.$executeRaw`
|
||||
UPDATE "gateway_release_operation"
|
||||
SET "lease_until" = CURRENT_TIMESTAMP - INTERVAL '1 second'
|
||||
WHERE "id" = ${operation.id}
|
||||
`;
|
||||
await expect(
|
||||
repository.claimNextOperation(new Date(now.getTime() + 1_001), {
|
||||
ownerId: 'controller-b',
|
||||
|
||||
@@ -114,6 +114,11 @@ describeDatabase('gateway operation lease and profile serialization', () => {
|
||||
await expect(
|
||||
repository.claimNextOperation(beforeReset, { ownerId: 'worker-b', durationMs: 1_000 })
|
||||
).resolves.toBeNull();
|
||||
await connector.prisma.$executeRaw`
|
||||
UPDATE "gateway_operation"
|
||||
SET "scheduled_at" = CURRENT_TIMESTAMP - INTERVAL '1 second'
|
||||
WHERE "id" = ${scheduledReset.id}
|
||||
`;
|
||||
await expect(
|
||||
repository.claimNextOperation(scheduledAt, { ownerId: 'worker-b', durationMs: 1_000 })
|
||||
).resolves.toMatchObject({ id: scheduledReset.id, type: 'RESET', status: 'RUNNING' });
|
||||
@@ -168,13 +173,18 @@ describeDatabase('gateway operation lease and profile serialization', () => {
|
||||
sourceRef: 'b'.repeat(40),
|
||||
requestedBy: 'deploy-admin',
|
||||
});
|
||||
await connector.prisma.$executeRaw`
|
||||
UPDATE "gateway_operation"
|
||||
SET "scheduled_at" = CURRENT_TIMESTAMP - INTERVAL '1 second'
|
||||
WHERE "id" = ${scheduledReset.id}
|
||||
`;
|
||||
|
||||
await expect(
|
||||
repository.claimNextOperation(scheduledAt, { ownerId: 'worker-a', durationMs: 1_000 })
|
||||
).resolves.toMatchObject({ id: scheduledReset.id, type: 'RESET', status: 'RUNNING' });
|
||||
await expect(repository.getOperation(interimDeploy.id)).resolves.toMatchObject({
|
||||
status: 'CANCELLED',
|
||||
completedAt: scheduledAt.toISOString(),
|
||||
completedAt: expect.any(String),
|
||||
});
|
||||
await expect(repository.listOperationLogs(interimDeploy.id)).resolves.toEqual([
|
||||
expect.objectContaining({
|
||||
@@ -405,6 +415,11 @@ describeDatabase('gateway operation lease and profile serialization', () => {
|
||||
durationMs: 1_000,
|
||||
})
|
||||
).resolves.toBeNull();
|
||||
await connector.prisma.$executeRaw`
|
||||
UPDATE "gateway_operation"
|
||||
SET "lease_until" = CURRENT_TIMESTAMP - INTERVAL '1 second'
|
||||
WHERE "id" = ${operation.id}
|
||||
`;
|
||||
const reclaimed = await repository.claimNextOperation(new Date(startedAt.getTime() + 1_001), {
|
||||
ownerId: 'worker-b',
|
||||
durationMs: 1_000,
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('readReleaseManifest', () => {
|
||||
await expect(readReleaseManifest(workspaceRoot)).resolves.toMatchObject({
|
||||
controllerProtocol: RELEASE_CONTROLLER_PROTOCOL,
|
||||
gatewaySchemaHead: '20260825000000_add_bulk_release_batches',
|
||||
gameSchemaHead: '20260903103000_add_input_event_clock_processing',
|
||||
gameSchemaHead: '20260903140000_split_message_wall_and_game_time',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user