Skip to content
Draft
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
10 changes: 5 additions & 5 deletions packages/core/e2e/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import fs from 'node:fs';
import path from 'node:path';
import { setTimeout as sleep } from 'node:timers/promises';
Expand Down Expand Up @@ -1110,7 +1110,7 @@
] as const;

for (const tc of startIndexCases) {
test(tc.name, { timeout: 60_000 }, async () => {
test(tc.name, { timeout: 120_000 }, async () => {
const run = await start(await e2e('outputStreamWorkflow'), []);

if (tc.waitForCompletion) {
Expand Down Expand Up @@ -1162,7 +1162,7 @@
test(
'getTailIndex returns correct index after stream completes',
{
timeout: 60_000,
timeout: 120_000,
},
async () => {
const run = await start(await e2e('outputStreamWorkflow'), []);
Expand All @@ -1179,7 +1179,7 @@
test(
'getTailIndex returns -1 before any chunks are written',
{
timeout: 60_000,
timeout: 120_000,
},
async () => {
const run = await start(await e2e('outputStreamWorkflow'), []);
Expand All @@ -1196,7 +1196,7 @@
test(
'getChunks returns same content as reading the stream',
{
timeout: 60_000,
timeout: 120_000,
},
async () => {
const run = await start(await e2e('outputStreamWorkflow'), []);
Expand Down Expand Up @@ -1238,7 +1238,7 @@

test(
'outputStreamInsideStepWorkflow - getWritable() called inside step functions',
{ timeout: 60_000 },
{ timeout: 120_000 },
async () => {
const run = await start(await e2e('outputStreamInsideStepWorkflow'), []);
const reader = run.getReadable().getReader();
Expand Down
32 changes: 16 additions & 16 deletions workbench/example/workflows/99_e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export async function sleepingWorkflow(durationMs = 10_000) {
export async function parallelSleepWorkflow() {
'use workflow';
const startTime = Date.now();
await Promise.all(Array.from({ length: 10 }, () => sleep('1s')));
await Promise.all(Array.from({ length: 10 }, () => sleep('6s')));
const endTime = Date.now();
return { startTime, endTime };
}
Expand All @@ -227,7 +227,7 @@ export async function sleepWinsRaceWorkflow() {
const startTime = Date.now();
const winner = await Promise.race([
delayMsStep(10_000, 'step'),
sleep('1s').then(() => 'sleep'),
sleep('6s').then(() => 'sleep'),
]);
const endTime = Date.now();
return { winner, durationMs: endTime - startTime };
Expand Down Expand Up @@ -277,7 +277,7 @@ export async function retainedInterleavingWorkflow(token: string) {
sleep('30s').then(() => 'sleep'),
]); // 'step'
// Wait boundary: plain sleep.
await sleep('1s');
await sleep('6s');
// Hook boundary: hook payload awaited in parallel with a primitive step.
using hook = createHook<{ delta: number }>({ token });
const [payload, g] = await Promise.all([hook, add(e + f, 100)]); // _, 137
Expand Down Expand Up @@ -356,15 +356,15 @@ export async function outputStreamWorkflow() {
'use workflow';
const writable = getWritable();
const namedWritable = getWritable({ namespace: 'test' });
await sleep('1s');
await sleep('6s');
await stepWithOutputStreamBinary(writable, 'Hello, world!');
await sleep('1s');
await sleep('6s');
await stepWithOutputStreamBinary(namedWritable, 'Hello, named stream!');
await sleep('1s');
await sleep('6s');
await stepWithOutputStreamObject(writable, { foo: 'test' });
await sleep('1s');
await sleep('6s');
await stepWithOutputStreamObject(namedWritable, { foo: 'bar' });
await sleep('1s');
await sleep('6s');
await stepCloseOutputStream(writable);
await stepCloseOutputStream(namedWritable);
return 'done';
Expand Down Expand Up @@ -402,17 +402,17 @@ async function stepCloseOutputStreamInsideStep(namespace?: string) {

export async function outputStreamInsideStepWorkflow() {
'use workflow';
await sleep('1s');
await sleep('6s');
await stepWithOutputStreamInsideStep('Hello from step!');
await sleep('1s');
await sleep('6s');
await stepWithNamedOutputStreamInsideStep('step-ns', {
message: 'Hello from named stream in step!',
});
await sleep('1s');
await sleep('6s');
await stepWithOutputStreamInsideStep('Second message');
await sleep('1s');
await sleep('6s');
await stepWithNamedOutputStreamInsideStep('step-ns', { counter: 42 });
await sleep('1s');
await sleep('6s');
await stepCloseOutputStreamInsideStep();
await stepCloseOutputStreamInsideStep('step-ns');
return 'done';
Expand Down Expand Up @@ -441,7 +441,7 @@ async function stepWriteUtf8Json(writable: WritableStream, value: unknown) {
export async function utf8StreamWorkflow() {
'use workflow';
const writable = getWritable();
await sleep('1s');
await sleep('6s');
await stepWriteUtf8Text(writable, 'Hello, world!');
await stepWriteUtf8Text(writable, 'Café — naïve résumé');
await stepWriteUtf8Text(writable, '你好,世界!🌍✨');
Expand Down Expand Up @@ -2549,7 +2549,7 @@ export async function abortSurvivesReplayWorkflow() {
const before = await checkSignalState(controller.signal);

// Sleep causes workflow to suspend and replay
await sleep('1s');
await sleep('6s');

// Abort after replay
controller.abort('after-replay');
Expand Down Expand Up @@ -2922,7 +2922,7 @@ export async function abortDeterministicBranchFromStepWorkflow() {
// which only runs at the next checkpoint that drains the promise queue —
// not synchronously after the step's await resolves. This mirrors how
// step return values become visible: only at a suspension boundary.
await sleep('1s');
await sleep('6s');

// Post-abort read. MUST be true on first-run AND replay — the events
// consumer has now drained `_setAborted` for the hook_received event.
Expand Down
2 changes: 1 addition & 1 deletion workbench/python/workflows/99_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async def sleepingWorkflow(durationMs: int = 10_000) -> dict:
@app.workflow
async def parallelSleepWorkflow() -> dict:
startTime = time_ns() // 1_000_000
await asyncio.gather(*(sleep("1s") for _ in range(10)))
await asyncio.gather(*(sleep("6s") for _ in range(10)))
endTime = time_ns() // 1_000_000
return {"startTime": startTime, "endTime": endTime}

Expand Down
Loading