test: 조건부 통합 fixture의 시계와 소유권을 격리한다

This commit is contained in:
2026-08-24 09:18:52 +00:00
parent 7a1254cb3a
commit 69000d4cb9
9 changed files with 78 additions and 26 deletions
@@ -34,6 +34,7 @@ liveDescribe('auction worker durable recovery', () => {
const createdRequestPrefixes: string[] = [];
const createdWorldIds: number[] = [];
const createdGeneralIds: number[] = [];
const lifecycleUserIds = ['auction-durable-host', 'auction-durable-bidder'];
beforeAll(async () => {
await connector.connect();
@@ -56,6 +57,8 @@ liveDescribe('auction worker durable recovery', () => {
await connector.prisma.worldState.deleteMany({ where: { id: { in: createdWorldIds } } });
}
if (createdGeneralIds.length > 0) {
await connector.prisma.message.deleteMany({ where: { mailbox: { in: createdGeneralIds } } });
await connector.prisma.webPushOutbox.deleteMany({ where: { userIds: { hasSome: lifecycleUserIds } } });
await connector.prisma.logEntry.deleteMany({ where: { generalId: { in: createdGeneralIds } } });
await connector.prisma.general.deleteMany({ where: { id: { in: createdGeneralIds } } });
}
@@ -366,6 +369,8 @@ liveDescribe('auction worker durable recovery', () => {
};
const lifecycleGeneralIds = [8_032, 8_033];
await connector.prisma.message.deleteMany({ where: { mailbox: { in: lifecycleGeneralIds } } });
await connector.prisma.webPushOutbox.deleteMany({ where: { userIds: { hasSome: lifecycleUserIds } } });
await connector.prisma.logEntry.deleteMany({ where: { generalId: { in: lifecycleGeneralIds } } });
await connector.prisma.general.deleteMany({ where: { id: { in: lifecycleGeneralIds } } });
await connector.prisma.worldState.deleteMany({ where: { id: worldId } });
@@ -472,7 +472,9 @@ integration('scenario 903 select pool through the durable turn daemon', () => {
}, 30_000);
it('keeps a stable ENGINE event for retries and rejects reservation bypasses', async () => {
const logicalNowMs = runtime!.world.getGameNow(new Date()).getTime();
const logicalNow = runtime!.world.getGameNow(new Date());
const logicalNowMs = logicalNow.getTime();
const logicalNowTick = runtime!.world.dateToGameTick(logicalNow);
const reservation = await appRouter
.createCaller(buildContext('select-pool-other-reserve', otherAuth))
.join.getSelectionPool();
@@ -488,7 +490,10 @@ integration('scenario 903 select pool through the durable turn daemon', () => {
await db.selectPoolEntry.update({
where: { uniqueName: candidate.uniqueName },
data: { reservedUntil: new Date(logicalNowMs - 60_000) },
data: {
reservedUntil: new Date(logicalNowMs - 60_000),
reservedUntilTick: BigInt(logicalNowTick - 1),
},
});
await expect(
appRouter.createCaller(buildContext('select-pool-expired-token', otherAuth)).join.selectPoolGeneral({