Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
- name: Run Tests
run: yarn test --ci --reporters=default --reporters=jest-junit
env:
CONDUCTOR_SERVER_URL: ${{ secrets.SERVER_URL }}
CONDUCTOR_AUTH_KEY: ${{ secrets.KEY_ID }}
CONDUCTOR_AUTH_SECRET: ${{ secrets.KEY_SECRET }}
CONDUCTOR_SERVER_URL: ${{ vars.SERVER_URL }}
CONDUCTOR_AUTH_KEY: ${{ secrets.AUTH_KEY }}
CONDUCTOR_AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
- name: Publish Test Results
if: always()
if: always()
uses: dorny/test-reporter@v2
with:
name: Test report
Expand Down
1 change: 1 addition & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export interface HttpTaskDef extends CommonTaskDef {
http_request: HttpInputParameters;
};
type: TaskType.HTTP;
asyncComplete?: boolean;
}

export interface InlineTaskInputParameters {
Expand Down
34 changes: 34 additions & 0 deletions src/core/__test__/executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {MetadataClient} from "../metadataClient";
import {TestUtil} from "./utils/test-util";
import {TaskResultStatusEnum} from "../../common/open-api/models/TaskResultStatusEnum";
import {SignalResponse} from "../../common/open-api/models/SignalResponse";
import { httpTask } from "../sdk";
import { TaskClient } from "../taskClient";

describe("Executor", () => {
const clientPromise = orkesConductorClient({ useEnvVars: true });
Expand Down Expand Up @@ -111,6 +113,38 @@ describe("Executor", () => {
const executionDetails = await executor.getWorkflow(executionId!, true);
expect(executionDetails.idempotencyKey).toEqual(idempotencyKey);
});

test("Should run workflow with http task with asyncComplete true", async () => {
const client = await clientPromise;
const executor = new WorkflowExecutor(client);

await executor.registerWorkflow(true, {
name: "test_jssdk_workflow_with_http_task_with_asyncComplete_true",
version: 1,
ownerEmail: "developers@orkes.io",
tasks: [httpTask("test_jssdk_http_task_with_asyncComplete_true", { uri: "http://www.yahoo.com", method: "GET" }, true)],
inputParameters: [],
outputParameters: {},
timeoutSeconds: 300,
});

const executionId = await executor.startWorkflow({
name: "test_jssdk_workflow_with_http_task_with_asyncComplete_true",
input: {},
version: 1,
});

const workflowStatusBefore = await TestUtil.waitForWorkflowStatus(executor, executionId, "RUNNING");

expect(["IN_PROGRESS", "SCHEDULED"]).toContain(workflowStatusBefore.tasks?.[0]?.status);

const taskClient = new TaskClient(client);
taskClient.updateTaskResult(executionId, "test_jssdk_http_task_with_asyncComplete_true", "COMPLETED", { hello: "From manuall api call updating task result" });

const workflowStatusAfter = await TestUtil.waitForWorkflowStatus(executor, executionId, "COMPLETED");

expect(workflowStatusAfter.tasks?.[0]?.status).toEqual("COMPLETED");
});
});

describe("Execute with Return Strategy and Consistency", () => {
Expand Down
1 change: 1 addition & 0 deletions src/core/generators/HttpTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const generateHTTPTask = (
method: "GET",
},
},
asyncComplete: false,
...overrides,
type: TaskType.HTTP,
});
1 change: 1 addition & 0 deletions src/core/sdk/__test__/factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ describe("httpTask", () => {
method: "GET",
});
expect(httpTaskObj).toEqual({
asyncComplete: false,
name: "httpTask",
taskReferenceName: "httpTask",
inputParameters: {
Expand Down
4 changes: 3 additions & 1 deletion src/core/sdk/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import {

export const httpTask = (
taskReferenceName: string,
inputParameters: HttpInputParameters
inputParameters: HttpInputParameters,
asyncComplete = false
): HttpTaskDef => ({
name: taskReferenceName,
taskReferenceName,
inputParameters: {
http_request: inputParameters,
},
asyncComplete,
type: TaskType.HTTP,
});