Return QueueNotFoundError from ArchiveAll* methods

This commit is contained in:
Ken Hibino
2021-05-07 16:06:07 -07:00
parent b440702039
commit 2a30fcb6ea
2 changed files with 76 additions and 5 deletions

View File

@@ -2577,6 +2577,35 @@ func TestArchiveAllScheduledTasks(t *testing.T) {
}
}
func TestArchiveAllTasksError(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.ArchiveAllPendingTasks(tc.qname); !tc.match(got) {
t.Errorf("%s: ArchiveAllPendingTasks returned %v", tc.desc, got)
}
if _, got := r.ArchiveAllScheduledTasks(tc.qname); !tc.match(got) {
t.Errorf("%s: ArchiveAllScheduledTasks returned %v", tc.desc, got)
}
if _, got := r.ArchiveAllRetryTasks(tc.qname); !tc.match(got) {
t.Errorf("%s: ArchiveAllRetryTasks returned %v", tc.desc, got)
}
}
}
func TestDeleteArchivedTask(t *testing.T) {
r := setup(t)
defer r.Close()