153
}
154
155
>
func (s *TaskQueueFairTaskSuite) createTaskQueue(rangeID int64) *persistencespb.TaskQueueInfo {
task_queue_fair_task.go
156
>
taskQueueKind := enumspb.TaskQueueKind(rand.Int31n(int32(len(enumspb.TaskQueueKind_name)) + 1))
157
>
taskQueue := s.randomTaskQueueInfo(taskQueueKind)
158
>
_, err := s.taskManager.CreateTaskQueue(s.ctx, &p.CreateTaskQueueRequest{
159
>
RangeID: rangeID,
160
>
TaskQueueInfo: taskQueue,
161
>
})
162
>
s.NoError(err)
163
>
return taskQueue
164
>
}
165
166
>
func (s *TaskQueueFairTaskSuite) randomTaskQueueInfo(taskQueueKind enumspb.TaskQueueKind) *persistencespb.TaskQueueInfo {
task_queue_fair_task.go
167
>
now := time.Now().UTC()
168
>
var expiryTime *timestamppb.Timestamp
169
>
if taskQueueKind == enumspb.TASK_QUEUE_KIND_STICKY {
170
expiryTime = timestamppb.New(now.Add(s.stickyTTL))
171
}
173
>
NamespaceId: s.namespaceID,
174
>
Name: s.taskQueueName,
175
>
TaskType: s.taskQueueType,
176
>
Kind: taskQueueKind,
177
>
AckLevel: rand.Int63(),
178
>
ExpiryTime: expiryTime,
179
>
LastUpdateTime: timestamppb.New(now),
180
>
}
181
}
182
183
>
func (s *TaskQueueFairTaskSuite) randomTask(taskID, pass int64) *persistencespb.AllocatedTaskInfo {
task_queue_fair_task.go
184
>
now := time.Now().UTC()
185
>
return &persistencespb.AllocatedTaskInfo{
186
>
TaskId: taskID,
187
>
TaskPass: pass,
188
>
Data: &persistencespb.TaskInfo{
189
>
NamespaceId: s.namespaceID,
190
>
WorkflowId: uuid.New().String(),
191
>
RunId: uuid.New().String(),
192
>
ScheduledEventId: rand.Int63(),
193
>
CreateTime: timestamppb.New(now),
194
>
ExpiryTime: timestamppb.New(now.Add(s.taskTTL)),
195
>
Clock: &clockspb.VectorClock{
196
>
ClusterId: rand.Int63(),
197
>
ShardId: rand.Int31(),
198
>
Clock: rand.Int63(),
199
>
},
200
>
},
201
>
}
202
>
}