Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b7f578

Browse files
authored
fix: Add reason to cancelation tasks in tests (temporalio#526)
* fix: Add reason to cancelation tasks in tests * Fix test-npm-init
1 parent ac7a8ec commit 6b7f578

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ jobs:
188188
name: packages-${{ matrix.target }}
189189
path: /tmp/registry/storage
190190
if: ${{ matrix.server != 'cloud' || env.TEMPORAL_CLIENT_CERT != '' }}
191-
- run: node scripts/init-from-verdaccio.js --registry-dir /tmp/registry --sample https://github.com/temporalio/samples-typescript/tree/next/${{ matrix.sample }}
191+
- run: node scripts/init-from-verdaccio.js --registry-dir /tmp/registry --sample https://github.com/temporalio/samples-typescript/tree/main/${{ matrix.sample }}
192192
if: ${{ matrix.server != 'cloud' || env.TEMPORAL_CLIENT_CERT != '' }}
193193
- name: Get Temporal docker-compose.yml
194194
run: wget https://raw.githubusercontent.com/temporalio/docker-compose/v1.13.0/docker-compose.yml

packages/test/src/test-worker-activities.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ test('Worker cancels activity and reports cancellation', async (t) => {
107107
});
108108
const completion = await worker.native.runActivityTask({
109109
taskToken,
110-
cancel: {},
110+
cancel: {
111+
reason: coresdk.activity_task.ActivityCancelReason.CANCELLED,
112+
},
111113
});
112114
compareCompletion(t, completion.result, {
113-
cancelled: { failure: { source: 'TypeScriptSDK', message: '', canceledFailureInfo: {} } },
115+
cancelled: { failure: { source: 'TypeScriptSDK', message: 'CANCELLED', canceledFailureInfo: {} } },
114116
});
115117
});
116118
});
@@ -131,7 +133,9 @@ test('Activity Context AbortSignal cancels a fetch request', async (t) => {
131133
});
132134
const completion = await worker.native.runActivityTask({
133135
taskToken,
134-
cancel: {},
136+
cancel: {
137+
reason: coresdk.activity_task.ActivityCancelReason.CANCELLED,
138+
},
135139
});
136140
compareCompletion(t, completion.result, {
137141
cancelled: { failure: { source: 'TypeScriptSDK', canceledFailureInfo: {} } },

packages/test/src/test-worker-lifecycle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* Test the various states of a Worker.
33
* Most tests use a mocked core, some tests run serially because they emit signals to the process
44
*/
5-
import test from 'ava';
65
import { Worker } from '@temporalio/worker';
7-
import { isolateFreeWorker, defaultOptions } from './mock-native-worker';
6+
import test from 'ava';
87
import { RUN_INTEGRATION_TESTS } from './helpers';
8+
import { defaultOptions, isolateFreeWorker } from './mock-native-worker';
99

1010
if (RUN_INTEGRATION_TESTS) {
1111
test.serial('run shuts down gracefully', async (t) => {

0 commit comments

Comments
 (0)