@@ -14,7 +14,8 @@ import {
14
14
} from '@temporalio/worker' ;
15
15
import * as activity from '@temporalio/activity' ;
16
16
import * as workflow from '@temporalio/workflow' ;
17
- import { CancelReason } from '@temporalio/worker/src/activity' ;
17
+ import { CancelReason } from '@temporalio/worker/lib/activity' ;
18
+ import { tsToMs } from '@temporalio/common/lib/time' ;
18
19
import { test as anyTest , bundlerOptions , Worker } from './helpers' ;
19
20
import { activityStartedSignal } from './workflows/definitions' ;
20
21
import { signalSchedulingWorkflow } from './activities/helpers' ;
@@ -125,8 +126,8 @@ test('Workflow fails if it tries to start a child with an existing workflow ID',
125
126
} ) ;
126
127
} ) ;
127
128
128
- export async function runTestActivity ( ) : Promise < void > {
129
- await workflow . proxyActivities ( { startToCloseTimeout : '1m' } ) . testActivity ( ) ;
129
+ export async function runTestActivity ( activityOptions ?: workflow . ActivityOptions ) : Promise < void > {
130
+ await workflow . proxyActivities ( { startToCloseTimeout : '1m' , ... activityOptions } ) . testActivity ( ) ;
130
131
}
131
132
132
133
test ( 'Worker cancels activities after shutdown has been requested' , async ( t ) => {
@@ -214,3 +215,25 @@ test('Condition 0 patch sets a timer', async (t) => {
214
215
const worker = await createWorker ( ) ;
215
216
t . false ( await worker . runUntil ( executeWorkflow ( conditionTimeout0 ) ) ) ;
216
217
} ) ;
218
+
219
+ test ( 'Activity initialInterval is not getting rounded' , async ( t ) => {
220
+ const { createWorker, startWorkflow } = helpers ( t ) ;
221
+ const worker = await createWorker ( {
222
+ activities : {
223
+ testActivity : ( ) => undefined ,
224
+ } ,
225
+ } ) ;
226
+ const handle = await startWorkflow ( runTestActivity , {
227
+ args : [
228
+ {
229
+ startToCloseTimeout : '5s' ,
230
+ retry : { initialInterval : '50ms' , maximumAttempts : 1 } ,
231
+ } ,
232
+ ] ,
233
+ } ) ;
234
+ await worker . runUntil ( handle . result ( ) ) ;
235
+ const { events } = await handle . fetchHistory ( ) ;
236
+ const activityTaskScheduledEvents = events ?. find ( ( ev ) => ev . activityTaskScheduledEventAttributes ) ;
237
+ const retryPolicy = activityTaskScheduledEvents ?. activityTaskScheduledEventAttributes ?. retryPolicy ;
238
+ t . is ( tsToMs ( retryPolicy ?. initialInterval ) , 50 ) ;
239
+ } ) ;
0 commit comments