@@ -17,6 +17,7 @@ import (
1717 "github.com/google/uuid"
1818 "go.temporal.io/api/common/v1"
1919 "go.temporal.io/api/enums/v1"
20+ "go.temporal.io/api/history/v1"
2021 "go.temporal.io/api/workflowservice/v1"
2122 "go.temporal.io/sdk/client"
2223 "go.temporal.io/sdk/converter"
@@ -953,3 +954,50 @@ func (s *SharedServerSuite) testStartUpdateWithStartHelper(opts updateWithStartT
953954 s .Equal (opts .expectedWfOutput ["workflow" ], wfReturn ["workflow" ])
954955 s .Equal (opts .expectedWfOutput ["update" ], wfReturn ["update" ])
955956}
957+
958+ func (s * SharedServerSuite ) TestWorkflow_Start_WithPriorityOptions () {
959+ s .Worker ().OnDevWorkflow (func (ctx workflow.Context , input any ) (any , error ) {
960+ return "success" , nil
961+ })
962+
963+ workflowId := "priority-test-" + uuid .New ().String ()
964+ res := s .Execute (
965+ "workflow" , "start" ,
966+ "--address" , s .Address (),
967+ "--task-queue" , s .Worker ().Options .TaskQueue ,
968+ "--type" , "DevWorkflow" ,
969+ "--workflow-id" , workflowId ,
970+ "--priority-key" , "2" ,
971+ "--fairness-key" , "high-priority-tenant" ,
972+ "--fairness-weight" , "5.5" ,
973+ )
974+ s .NoError (res .Err )
975+
976+ ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
977+ defer cancel ()
978+
979+ iter := s .Client .GetWorkflowHistory (ctx ,
980+ workflowId , "" , false , enums .HISTORY_EVENT_FILTER_TYPE_ALL_EVENT )
981+
982+ var startedEvent * history.HistoryEvent
983+ for iter .HasNext () {
984+ event , err := iter .Next ()
985+ s .NoError (err )
986+ if event .EventType == enums .EVENT_TYPE_WORKFLOW_EXECUTION_STARTED {
987+ startedEvent = event
988+ break
989+ }
990+ }
991+
992+ s .NotNil (startedEvent , "WorkflowExecutionStarted event not found" )
993+
994+ startedAttrs := startedEvent .GetWorkflowExecutionStartedEventAttributes ()
995+ s .NotNil (startedAttrs , "WorkflowExecutionStarted attributes not found" )
996+
997+ priority := startedAttrs .GetPriority ()
998+ s .NotNil (priority , "Priority not found in WorkflowExecutionStarted event" )
999+
1000+ s .Equal (int32 (2 ), priority .GetPriorityKey ())
1001+ s .Equal ("high-priority-tenant" , priority .GetFairnessKey ())
1002+ s .Equal (float32 (5.5 ), priority .GetFairnessWeight ())
1003+ }
0 commit comments