@@ -14,6 +14,7 @@ import (
1414 "github.com/stretchr/testify/mock"
1515 "github.com/stretchr/testify/require"
1616 "github.com/stretchr/testify/suite"
17+ activitypb "go.temporal.io/api/activity/v1"
1718 batchpb "go.temporal.io/api/batch/v1"
1819 commonpb "go.temporal.io/api/common/v1"
1920 enumspb "go.temporal.io/api/enums/v1"
@@ -914,6 +915,31 @@ func (s *WorkflowHandlerSuite) TestStartWorkflowExecution_Failed_InvalidAggregat
914915 s .ErrorContains (err , "cannot attach more than 10 links per request, got 11" )
915916}
916917
918+ func (s * WorkflowHandlerSuite ) TestStartWorkflowExecution_Priority () {
919+ config := s .newConfig ()
920+ wh := s .getWorkflowHandler (config )
921+
922+ s .mockSearchAttributesMapperProvider .EXPECT ().GetMapper (gomock .Any ()).Return (nil , nil ).AnyTimes ()
923+
924+ request := & workflowservice.StartWorkflowExecutionRequest {
925+ Namespace : s .testNamespace .String (),
926+ WorkflowId : "workflow-id" ,
927+ WorkflowType : & commonpb.WorkflowType {
928+ Name : "workflow-type" ,
929+ },
930+ TaskQueue : & taskqueuepb.TaskQueue {
931+ Name : "task-queue" ,
932+ },
933+ Priority : & commonpb.Priority {PriorityKey : - 1 },
934+ }
935+
936+ _ , err := wh .StartWorkflowExecution (context .Background (), request )
937+ var invalidArg * serviceerror.InvalidArgument
938+ s .ErrorAs (err , & invalidArg )
939+ s .ErrorContains (err , "priority key can't be negative" )
940+ // NOTE: only testing a single validation scenario here; the priority validation has its own unit tests
941+ }
942+
917943func (s * WorkflowHandlerSuite ) TestSignalWithStartWorkflowExecution_InvalidWorkflowIdConflictPolicy () {
918944 config := s .newConfig ()
919945 wh := s .getWorkflowHandler (config )
@@ -1011,6 +1037,32 @@ func (s *WorkflowHandlerSuite) TestSignalWithStartWorkflowExecution_Failed_Inval
10111037 s .ErrorContains (err , "link exceeds allowed size of 4000" )
10121038}
10131039
1040+ func (s * WorkflowHandlerSuite ) TestSignalWithStartWorkflowExecution_Priority () {
1041+ config := s .newConfig ()
1042+ wh := s .getWorkflowHandler (config )
1043+
1044+ s .mockSearchAttributesMapperProvider .EXPECT ().GetMapper (gomock .Any ()).Return (nil , nil ).AnyTimes ()
1045+
1046+ request := & workflowservice.SignalWithStartWorkflowExecutionRequest {
1047+ Namespace : s .testNamespace .String (),
1048+ WorkflowId : "workflow-id" ,
1049+ WorkflowType : & commonpb.WorkflowType {
1050+ Name : "workflow-type" ,
1051+ },
1052+ TaskQueue : & taskqueuepb.TaskQueue {
1053+ Name : "task-queue" ,
1054+ },
1055+ SignalName : "signal-name" ,
1056+ Priority : & commonpb.Priority {PriorityKey : - 1 },
1057+ }
1058+
1059+ _ , err := wh .SignalWithStartWorkflowExecution (context .Background (), request )
1060+ var invalidArg * serviceerror.InvalidArgument
1061+ s .ErrorAs (err , & invalidArg )
1062+ s .ErrorContains (err , "priority key can't be negative" )
1063+ // NOTE: only testing a single validation scenario here; the priority validation has its own unit tests
1064+ }
1065+
10141066func (s * WorkflowHandlerSuite ) TestSignalWorkflowExecution_Failed_InvalidLinks () {
10151067 s .mockSearchAttributesMapperProvider .EXPECT ().GetMapper (gomock .Any ()).AnyTimes ().Return (nil , nil )
10161068 config := s .newConfig ()
@@ -3958,3 +4010,52 @@ func (s *WorkflowHandlerSuite) TestUpdateTaskQueueConfig_Validation() {
39584010 s .NotNil (resp )
39594011 })
39604012}
4013+
4014+ func (s * WorkflowHandlerSuite ) TestUpdateWorkflowExecutionOptions_Priority () {
4015+ config := s .newConfig ()
4016+ wh := s .getWorkflowHandler (config )
4017+
4018+ request := & workflowservice.UpdateWorkflowExecutionOptionsRequest {
4019+ Namespace : s .testNamespace .String (),
4020+ WorkflowExecution : & commonpb.WorkflowExecution {
4021+ WorkflowId : "workflow-id" ,
4022+ RunId : "run-id" ,
4023+ },
4024+ WorkflowExecutionOptions : & workflowpb.WorkflowExecutionOptions {
4025+ Priority : & commonpb.Priority {PriorityKey : - 1 },
4026+ },
4027+ UpdateMask : & fieldmaskpb.FieldMask {Paths : []string {"priority" }},
4028+ }
4029+
4030+ _ , err := wh .UpdateWorkflowExecutionOptions (context .Background (), request )
4031+ var invalidArg * serviceerror.InvalidArgument
4032+ s .ErrorAs (err , & invalidArg )
4033+ s .ErrorContains (err , "priority key can't be negative" )
4034+ // NOTE: only testing a single validation scenario here; the priority validation has its own unit tests
4035+ }
4036+
4037+ func (s * WorkflowHandlerSuite ) TestUpdateActivityOptions_Priority () {
4038+ config := s .newConfig ()
4039+ wh := s .getWorkflowHandler (config )
4040+
4041+ request := & workflowservice.UpdateActivityOptionsRequest {
4042+ Namespace : s .testNamespace .String (),
4043+ Execution : & commonpb.WorkflowExecution {
4044+ WorkflowId : "workflow-id" ,
4045+ RunId : "run-id" ,
4046+ },
4047+ Activity : & workflowservice.UpdateActivityOptionsRequest_Id {
4048+ Id : "activity-id" ,
4049+ },
4050+ ActivityOptions : & activitypb.ActivityOptions {
4051+ Priority : & commonpb.Priority {PriorityKey : - 1 },
4052+ },
4053+ UpdateMask : & fieldmaskpb.FieldMask {Paths : []string {"priority" }},
4054+ }
4055+
4056+ _ , err := wh .UpdateActivityOptions (context .Background (), request )
4057+ var invalidArg * serviceerror.InvalidArgument
4058+ s .ErrorAs (err , & invalidArg )
4059+ s .ErrorContains (err , "priority key can't be negative" )
4060+ // NOTE: only testing a single validation scenario here; the priority validation has its own unit tests
4061+ }
0 commit comments