Skip to content

Commit a6ba640

Browse files
committed
test(driver): wait for wasm db sleep recovery
1 parent 3444072 commit a6ba640

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

rivetkit-typescript/packages/rivetkit/tests/driver/actor-db.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const CHUNK_SIZE = 4096;
1313
const LARGE_PAYLOAD_SIZE = 32768;
1414
const HIGH_VOLUME_COUNT = 1000;
1515
const SLEEP_WAIT_MS = 150;
16+
const WASM_REMOTE_SLEEP_RECOVERY_TIMEOUT_MS = 30_000;
1617
const LIFECYCLE_POLL_INTERVAL_MS = 25;
1718
const LIFECYCLE_POLL_ATTEMPTS = 40;
1819
const REAL_TIMER_DB_TIMEOUT_MS = 180_000;
@@ -79,7 +80,7 @@ async function runWithActorStoppingRetry(
7980
}
8081

8182
async function expectIntegrityCheckOk(
82-
_driverTestConfig: DriverTestConfig,
83+
driverTestConfig: DriverTestConfig,
8384
integrityCheck: () => Promise<string>,
8485
): Promise<void> {
8586
// Same lifecycle window as `runWithActorStoppingRetry`: the integrity
@@ -96,7 +97,13 @@ async function expectIntegrityCheckOk(
9697
throw error;
9798
}
9899
},
99-
{ timeout: SLEEP_WAIT_MS * 8, interval: 100 },
100+
{
101+
timeout:
102+
driverTestConfig.runtime === "wasm"
103+
? WASM_REMOTE_SLEEP_RECOVERY_TIMEOUT_MS
104+
: SLEEP_WAIT_MS * 8,
105+
interval: 100,
106+
},
100107
);
101108
}
102109

@@ -276,6 +283,7 @@ describeDriverMatrix("Actor Db", (driverTestConfig) => {
276283
expect(
277284
sleepEvent.timestamp - sleepRequestedAt,
278285
).toBeLessThanOrEqual(SLEEP_OBSERVER_TIMEOUT_MS);
286+
await waitFor(driverTestConfig, SLEEP_WAIT_MS);
279287

280288
const countAfterWake = await actor.getCount();
281289
expect(countAfterWake).toBe(baselineCount);
@@ -527,6 +535,7 @@ describeDriverMatrix("Actor Db", (driverTestConfig) => {
527535
);
528536

529537
await actor.triggerSleep();
538+
await waitFor(driverTestConfig, SLEEP_WAIT_MS);
530539
await expectIntegrityCheckOk(
531540
driverTestConfig,
532541
async () => await actor.integrityCheck(),

0 commit comments

Comments
 (0)