@@ -8,7 +8,7 @@ import { configMacro, makeTestFn } from './helpers-integration-multi-codec';
88import { configurableHelpers } from './helpers-integration' ;
99import { withZeroesHTTPServer } from './zeroes-http-server' ;
1010import * as activities from './activities' ;
11- import { cleanOptionalStackTrace } from './helpers' ;
11+ import { approximatelyEqual , cleanOptionalStackTrace } from './helpers' ;
1212import * as workflows from './workflows' ;
1313
1414const test = makeTestFn ( ( ) => bundleWorkflowCode ( { workflowsPath : require . resolve ( './workflows' ) } ) ) ;
@@ -151,7 +151,7 @@ test(
151151 const worker = await createWorkerWithDefaults ( t , { activities } ) ;
152152 const handle = await startWorkflow ( workflows . priorityWorkflow , {
153153 args : [ false , 1 ] ,
154- priority : { priorityKey : 1 } ,
154+ priority : { priorityKey : 1 , fairnessKey : 'main-workflow' , fairnessWeight : 3.0 } ,
155155 } ) ;
156156 await worker . runUntil ( handle . result ( ) ) ;
157157 let firstChild = true ;
@@ -161,19 +161,28 @@ test(
161161 switch ( event . eventType ) {
162162 case temporal . api . enums . v1 . EventType . EVENT_TYPE_WORKFLOW_EXECUTION_STARTED :
163163 t . deepEqual ( event . workflowExecutionStartedEventAttributes ?. priority ?. priorityKey , 1 ) ;
164+ t . deepEqual ( event . workflowExecutionStartedEventAttributes ?. priority ?. fairnessKey , 'main-workflow' ) ;
165+ t . deepEqual ( event . workflowExecutionStartedEventAttributes ?. priority ?. fairnessWeight , 3.0 ) ;
164166 break ;
165167 case temporal . api . enums . v1 . EventType . EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED : {
166- const pri = event . startChildWorkflowExecutionInitiatedEventAttributes ?. priority ?. priorityKey ;
168+ const priority = event . startChildWorkflowExecutionInitiatedEventAttributes ?. priority ;
167169 if ( firstChild ) {
168- t . deepEqual ( pri , 4 ) ;
170+ t . deepEqual ( priority ?. priorityKey , 4 ) ;
171+ t . deepEqual ( priority ?. fairnessKey , 'child-workflow-1' ) ;
172+ t . deepEqual ( priority ?. fairnessWeight , 2.5 ) ;
169173 firstChild = false ;
170174 } else {
171- t . deepEqual ( pri , 2 ) ;
175+ t . deepEqual ( priority ?. priorityKey , 2 ) ;
176+ t . deepEqual ( priority ?. fairnessKey , 'child-workflow-2' ) ;
177+ t . deepEqual ( priority ?. fairnessWeight , 1.0 ) ;
172178 }
173179 break ;
174180 }
175181 case temporal . api . enums . v1 . EventType . EVENT_TYPE_ACTIVITY_TASK_SCHEDULED :
176182 t . deepEqual ( event . activityTaskScheduledEventAttributes ?. priority ?. priorityKey , 5 ) ;
183+ t . deepEqual ( event . activityTaskScheduledEventAttributes ?. priority ?. fairnessKey , 'fair-activity' ) ;
184+ // For some insane reason when proto reads this event it mangles the number to 4.19999999 something. Thanks Javascript.
185+ t . assert ( approximatelyEqual ( event . activityTaskScheduledEventAttributes ?. priority ?. fairnessWeight , 4.2 ) ) ;
177186 break ;
178187 }
179188 }
0 commit comments