Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { HIBERNATION_SLEEP_TIMEOUT } from "../../../fixtures/driver-test-suite/h
import type { DriverTestConfig } from "../mod";
import { setupDriverTest, waitFor } from "../utils";

// TODO(RVT-6193): Several tests below use fixed waitFor windows around
// hibernation handoff. Those waits should go away once requests block until
// the next ready actor generation instead of probing shutdown timing.
export function runActorConnHibernationTests(
driverTestConfig: DriverTestConfig,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ export function runActorDbPragmaMigrationTests(

// Sleep and wake
await actor.triggerSleep();
// TODO(RVT-6193): This fixed delay should not be needed.
// The follow up request should block until the woken actor is ready.
await waitFor(driverTestConfig, SLEEP_WAIT_MS);

// After wake, onMigrate runs again but should not fail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const HOT_ROW_UPDATES = 240;
const INTEGRITY_SEED_COUNT = 64;
const INTEGRITY_CHURN_COUNT = 120;

// TODO(RVT-6193): Sleep and wake routing should hide this transient lifecycle
// error from callers instead of forcing tests to special case it.
function isActorStoppingDbError(error: unknown): boolean {
return (
error instanceof Error &&
Expand Down Expand Up @@ -171,6 +173,9 @@ export function runActorDbTests(driverTestConfig: DriverTestConfig) {

for (let i = 0; i < 3; i++) {
await actor.triggerSleep();
// TODO(RVT-6193): This fixed delay should not be needed.
// Requests after sleep should wait for the next ready
// actor generation instead of probing the handoff window.
await waitFor(driverTestConfig, SLEEP_WAIT_MS);

let countAfterWake = -1;
Expand Down Expand Up @@ -476,6 +481,8 @@ export function runActorDbTests(driverTestConfig: DriverTestConfig) {
);

await actor.triggerSleep();
// TODO(RVT-6193): This fixed delay should not be needed.
// The post sleep request should route once the actor is ready.
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
expect((await actor.integrityCheck()).toLowerCase()).toBe(
"ok",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function buildInspectorUrl(
return url.toString();
}

// TODO(RVT-6193): Sleep and wake routing should hide this transient lifecycle
// error from callers instead of forcing tests to special case it.
function isActorStoppingDbError(error: unknown): boolean {
return (
error instanceof Error &&
Expand Down Expand Up @@ -418,6 +420,8 @@ export function runActorInspectorTests(driverTestConfig: DriverTestConfig) {
if (!isActorStoppingDbError(error)) {
throw error;
}
// TODO(RVT-6193): This retry delay should not be needed.
// The request should wait for the next ready actor generation.
await waitFor(driverTestConfig, 25);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ async function waitForConnected(
);
}

// TODO(RVT-6193): Several tests below use fixed waitFor windows around sleep
// and wake handoff. Those waits should go away once requests block until the
// next ready actor generation instead of probing shutdown timing.
export function runActorSleepDbTests(driverTestConfig: DriverTestConfig) {
const describeSleepDbTests = driverTestConfig.skip?.sleep
? describe.skip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export function runActorSleepTests(driverTestConfig: DriverTestConfig) {
// Trigger sleep
await sleepActor.triggerSleep();

// HACK: Wait for sleep to finish in background
// TODO(RVT-6193): This fixed delay should not be needed.
// The next request should wait for the woken actor generation.
await waitFor(driverTestConfig, 250);

// Get sleep count after restore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export function runActorStateZodCoercionTests(

// Sleep and wake
await actor.triggerSleep();
// TODO(RVT-6193): This fixed delay should not be needed.
// The next request should wait for the woken actor generation.
await waitFor(driverTestConfig, SLEEP_WAIT_MS);

const state = await actor.getState();
Expand Down Expand Up @@ -49,6 +51,8 @@ export function runActorStateZodCoercionTests(

// Sleep
await actor.triggerSleep();
// TODO(RVT-6193): This fixed delay should not be needed.
// The next request should wait for the woken actor generation.
await waitFor(driverTestConfig, SLEEP_WAIT_MS);

// Wake and verify Zod parse preserved values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
import type { DriverTestConfig } from "../mod";
import { setupDriverTest, waitFor } from "../utils";

// TODO(RVT-6193): Sleep and wake routing should hide this transient lifecycle
// error from callers instead of forcing tests to special case it.
function isActorStoppingConnectionError(error: unknown): boolean {
return (
error instanceof Error &&
Expand Down Expand Up @@ -484,6 +486,8 @@ export function runActorWorkflowTests(driverTestConfig: DriverTestConfig) {
expect(state.wakeCount).toBe(1);

await actor.triggerSleep();
// TODO(RVT-6193): This fixed delay should not be needed.
// The follow up request should wait for the next ready generation.
await waitFor(driverTestConfig, 250);

let resumedState = await actor.getErrorState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { setupDriverTest, waitFor } from "../utils";

const HIBERNATABLE_ACK_SETTLE_TIMEOUT_MS = 12_000;

// TODO(RVT-6193): Several tests below use fixed waitFor windows around
// hibernation handoff. Those waits should go away once requests block until
// the next ready actor generation instead of probing shutdown timing.
async function waitForJsonMessage(
ws: WebSocket,
timeoutMs: number,
Expand Down
Loading