mirror of
https://github.com/hibiken/asynq.git
synced 2025-09-19 21:27:42 +08:00
Return QueueNotFoundError from DeleteAll* methods
This commit is contained in:
@@ -3313,6 +3313,38 @@ func TestDeleteAllPendingTasks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteAllTasksError(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.DeleteAllPendingTasks(tc.qname); !tc.match(got) {
|
||||
t.Errorf("%s: DeleteAllPendingTasks returned %v", tc.desc, got)
|
||||
}
|
||||
if _, got := r.DeleteAllScheduledTasks(tc.qname); !tc.match(got) {
|
||||
t.Errorf("%s: DeleteAllScheduledTasks returned %v", tc.desc, got)
|
||||
}
|
||||
if _, got := r.DeleteAllRetryTasks(tc.qname); !tc.match(got) {
|
||||
t.Errorf("%s: DeleteAllRetryTasks returned %v", tc.desc, got)
|
||||
}
|
||||
if _, got := r.DeleteAllArchivedTasks(tc.qname); !tc.match(got) {
|
||||
t.Errorf("%s: DeleteAllArchivedTasks returned %v", tc.desc, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveQueue(t *testing.T) {
|
||||
r := setup(t)
|
||||
defer r.Close()
|
||||
|
Reference in New Issue
Block a user