2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-08-19 23:19:10 +08:00

Update RDB.RunAll* methods with task state

This commit is contained in:
Ken Hibino
2021-05-07 16:31:07 -07:00
parent dd66acef1b
commit cde3e57c6c
2 changed files with 93 additions and 7 deletions

View File

@@ -1711,6 +1711,35 @@ func TestRunAllArchivedTasks(t *testing.T) {
}
}
func TestRunAllTasksError(t *testing.T) {
r := setup(t)
defer r.Close()
tests := []struct {
desc string
qname string
match func(err error) bool
}{
{
desc: "It returns QueueNotFoundError if queue doesn't exist",
qname: "nonexistent",
match: errors.IsQueueNotFound,
},
}
for _, tc := range tests {
if _, got := r.RunAllScheduledTasks(tc.qname); !tc.match(got) {
t.Errorf("%s: RunAllScheduledTasks returned %v", tc.desc, got)
}
if _, got := r.RunAllRetryTasks(tc.qname); !tc.match(got) {
t.Errorf("%s: RunAllRetryTasks returned %v", tc.desc, got)
}
if _, got := r.RunAllArchivedTasks(tc.qname); !tc.match(got) {
t.Errorf("%s: RunAllArchivedTasks returned %v", tc.desc, got)
}
}
}
func TestArchiveRetryTask(t *testing.T) {
r := setup(t)
defer r.Close()