236
func (s *TaskQueueTaskSuite) createTaskQueue(
237
rangeID int64,
239
>
taskQueueKind := enumspb.TaskQueueKind(rand.Int31n(
240
>
int32(len(enumspb.TaskQueueKind_name)) + 1),
241
>
)
242
>
taskQueue := s.randomTaskQueueInfo(taskQueueKind)
243
>
_, err := s.taskManager.CreateTaskQueue(s.ctx, &p.CreateTaskQueueRequest{
244
>
RangeID: rangeID,
245
>
TaskQueueInfo: taskQueue,
246
>
})
247
>
s.NoError(err)
248
>
return taskQueue
249
>
}
250
251
func (s *TaskQueueTaskSuite) randomTaskQueueInfo(
252
taskQueueKind enumspb.TaskQueueKind,
254
>
now := time.Now().UTC()
255
>
var expiryTime *timestamppb.Timestamp
256
>
if taskQueueKind == enumspb.TASK_QUEUE_KIND_STICKY {
257
expiryTime = timestamppb.New(now.Add(s.stickyTTL))
258
}
259
261
>
NamespaceId: s.namespaceID,
262
>
Name: s.taskQueueName,
263
>
TaskType: s.taskQueueType,
264
>
Kind: taskQueueKind,
265
>
AckLevel: rand.Int63(),
266
>
ExpiryTime: expiryTime,
267
>
LastUpdateTime: timestamppb.New(now),
268
>
}
269
}
270
271
func (s *TaskQueueTaskSuite) randomTask(
272
taskID int64,
274
>
now := time.Now().UTC()
275
>
return &persistencespb.AllocatedTaskInfo{
276
>
TaskId: taskID,
277
>
Data: &persistencespb.TaskInfo{
278
>
NamespaceId: s.namespaceID,
279
>
WorkflowId: uuid.New().String(),
280
>
RunId: uuid.New().String(),
281
>
ScheduledEventId: rand.Int63(),
282
>
CreateTime: timestamppb.New(now),
283
>
ExpiryTime: timestamppb.New(now.Add(s.taskTTL)),
284
>
Clock: &clockspb.VectorClock{
285
>
ClusterId: rand.Int63(),
286
>
ShardId: rand.Int31(),
287
>
Clock: rand.Int63(),
288
>
},
289
>
},
290
>
}
291
>
}