Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[For merge on sdk-typescript release] respond to upstream TS changes: required waitForStage #504

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion features/update/async_accepted/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
import * as assert from 'assert';
import ms from 'ms';
import { Duration, StringValue } from '@temporalio/common';
import { WorkflowUpdateStage } from '@temporalio/client';

Check failure on line 6 in features/update/async_accepted/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

'"@temporalio/client"' has no exported member named 'WorkflowUpdateStage'. Did you mean 'WorkflowUpdateType'?

const myUpdate = wf.defineUpdate<void, [Duration, boolean]>('myUpdate');
const requestedSleep = '2s';

export const feature = new Feature({
workflow,
checkResult: async (_, handle) => {
const timeToAccept = await time(handle.startUpdate(myUpdate, { args: [requestedSleep, false] }));
const timeToAccept = await time(
handle.startUpdate(myUpdate, { args: [requestedSleep, false], waitForStage: WorkflowUpdateStage.ACCEPTED })

Check failure on line 15 in features/update/async_accepted/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

No overload matches this call.
);
const timeToComplete = await time(handle.executeUpdate(myUpdate, { args: [requestedSleep, false] }));
assert.equal(
ms(timeToAccept) < ms(requestedSleep),
Expand Down
12 changes: 9 additions & 3 deletions features/update/basic_async/feature.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WorkflowUpdateFailedError } from '@temporalio/client';
import { WorkflowUpdateFailedError, WorkflowUpdateStage } from '@temporalio/client';

Check failure on line 1 in features/update/basic_async/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

'"@temporalio/client"' has no exported member named 'WorkflowUpdateStage'. Did you mean 'WorkflowUpdateType'?
import { Feature } from '@temporalio/harness';
import * as wf from '@temporalio/workflow';
import * as assert from 'assert';
Expand Down Expand Up @@ -29,7 +29,10 @@
export const feature = new Feature({
workflow,
checkResult: async (runner, handle) => {
const badUpdateHandle = await handle.startUpdate(myUpdate, { args: ['invalid-arg'] });
const badUpdateHandle = await handle.startUpdate(myUpdate, {

Check failure on line 32 in features/update/basic_async/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

No overload matches this call.
args: ['invalid-arg'],
waitForStage: WorkflowUpdateStage.ACCEPTED,
});
try {
await badUpdateHandle.result();
throw 'Expected update to fail';
Expand All @@ -39,7 +42,10 @@
}
}

const updateHandle = await handle.startUpdate(myUpdate, { args: ['update-arg'] });
const updateHandle = await handle.startUpdate(myUpdate, {

Check failure on line 45 in features/update/basic_async/feature.ts

View workflow job for this annotation

GitHub Actions / build-ts (ubuntu-latest)

No overload matches this call.
args: ['update-arg'],
waitForStage: WorkflowUpdateStage.ACCEPTED,
});
const updateResult = await updateHandle.result();
assert.equal(updateResult, 'update-result');
const workflowResult = await runner.waitForRunResult(handle);
Expand Down
Loading