diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 76a1d066..a2cb0594 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -40,7 +40,7 @@ jobs: name: "Features integration test (sdk-test-suite version ${{ matrix.sdk-test-suite }})" strategy: matrix: - sdk-test-suite: ["1.5"] + sdk-test-suite: ["2.1"] permissions: contents: read issues: read diff --git a/packages/restate-e2e-services/exclusions.yaml b/packages/restate-e2e-services/exclusions.yaml index 7831c238..76f5164e 100644 --- a/packages/restate-e2e-services/exclusions.yaml +++ b/packages/restate-e2e-services/exclusions.yaml @@ -1 +1,7 @@ -exclusions: {} +exclusions: + "alwaysSuspending": + - "dev.restate.sdktesting.tests.RunRetry" + "default": + - "dev.restate.sdktesting.tests.RunRetry" + "singleThreadSinglePartition": + - "dev.restate.sdktesting.tests.RunRetry" diff --git a/packages/restate-e2e-services/src/list.ts b/packages/restate-e2e-services/src/list.ts index ac10ca1d..75d1a14d 100644 --- a/packages/restate-e2e-services/src/list.ts +++ b/packages/restate-e2e-services/src/list.ts @@ -35,3 +35,5 @@ const o = restate.object({ }); REGISTRY.addObject(o); + +export type ListObject = typeof o; diff --git a/packages/restate-e2e-services/src/proxy.ts b/packages/restate-e2e-services/src/proxy.ts index b08374cd..808f883e 100644 --- a/packages/restate-e2e-services/src/proxy.ts +++ b/packages/restate-e2e-services/src/proxy.ts @@ -17,6 +17,7 @@ type ProxyRequest = { virtualObjectKey?: string; handlerName: string; message: Array; + delayMillis?: number; }; type ManyCallRequest = { @@ -46,6 +47,7 @@ function rawSend(ctx: restate.Context, request: ProxyRequest) { key: request.virtualObjectKey, inputSerde: restate.serde.binary, parameter: new Uint8Array(request.message), + delay: request.delayMillis, }); } diff --git a/packages/restate-e2e-services/src/test_utils.ts b/packages/restate-e2e-services/src/test_utils.ts index 747f7779..517a2227 100644 --- a/packages/restate-e2e-services/src/test_utils.ts +++ b/packages/restate-e2e-services/src/test_utils.ts @@ -11,8 +11,20 @@ import * as restate from "@restatedev/restate-sdk"; import { REGISTRY } from "./services.js"; import type { AwakeableHolder } from "./awakeable_holder.js"; +import * as process from "node:process"; +import { ListObject } from "./list.js"; const AwakeableHolder: AwakeableHolder = { name: "AwakeableHolder" }; +const ListObject: ListObject = { name: "ListObject" }; + +type Command = + | { type: "createAwakeableAndAwaitIt"; awakeableKey: string } + | { type: "getEnvVariable"; envName: string }; + +interface InterpretRequest { + listName: string; + commands: Command[]; +} const o = restate.service({ name: "TestUtilsService", @@ -32,6 +44,13 @@ const o = restate.service({ ); }, + rawEcho: restate.handlers.handler( + { input: restate.serde.binary, output: restate.serde.binary }, + (ctx: restate.Context, input: Uint8Array) => { + return Promise.resolve(input); + } + ), + async createAwakeableAndAwaitIt( ctx: restate.Context, req: { awakeableKey: string; awaitTimeout?: number } @@ -82,6 +101,42 @@ const o = restate.service({ return invokedSideEffects; }, + + async getEnvVariable(ctx: restate.Context, env: string): Promise { + return ctx.run(() => process.env[env] ?? ""); + }, + + async interpretCommands( + ctx: restate.Context, + req: InterpretRequest + ): Promise { + const listClient = ctx.objectSendClient(ListObject, req.listName); + + async function createAwakeableAndAwaitIt( + awakeableKey: string + ): Promise { + const { id, promise } = ctx.awakeable(); + await ctx.objectClient(AwakeableHolder, awakeableKey).hold(id); + return promise; + } + + async function getEnvVariable(envName: string): Promise { + return ctx.run(() => process.env[envName] ?? ""); + } + + for (const command of req.commands) { + switch (command.type) { + case "createAwakeableAndAwaitIt": + listClient.append( + await createAwakeableAndAwaitIt(command.awakeableKey) + ); + break; + case "getEnvVariable": + listClient.append(await getEnvVariable(command.envName)); + break; + } + } + }, }, });