80
}
81
83
>
rangeID := rand.Int63()
84
>
taskQueue := s.createTaskQueue(rangeID)
85
>
86
>
tasks := []*persistencespb.AllocatedTaskInfo{
87
>
s.randomTask(10, 2), // higher pass
88
>
s.randomTask(20, 1), // lower pass, higher id
89
>
s.randomTask(5, 1), // same pass, lower id
90
>
s.randomTask(15, 2), // same pass as first but lower id
91
>
}
92
>
93
>
_, err := s.taskManager.CreateTasks(s.ctx, &p.CreateTasksRequest{
94
>
TaskQueueInfo: &p.PersistedTaskQueueInfo{RangeID: rangeID, Data: taskQueue},
95
>
Tasks: tasks,
96
>
})
97
>
s.NoError(err)
98
>
99
>
resp, err := s.taskManager.GetTasks(s.ctx, &p.GetTasksRequest{
100
>
NamespaceID: s.namespaceID,
101
>
TaskQueue: s.taskQueueName,
102
>
TaskType: s.taskQueueType,
103
>
InclusiveMinPass: 1,
104
>
InclusiveMinTaskID: 0,
105
>
ExclusiveMaxTaskID: math.MaxInt64,
106
>
PageSize: 10,
107
>
})
108
>
s.NoError(err)
109
>
110
>
expected := []*persistencespb.AllocatedTaskInfo{tasks[2], tasks[1], tasks[0], tasks[3]}
111
>
protorequire.ProtoSliceEqual(s.T(), expected, resp.Tasks)
112
>
s.Nil(resp.NextPageToken)
113
>
}
114
115
func (s *TaskQueueFairTaskSuite) TestCreateDelete_Range() {