2
0
mirror of https://github.com/hibiken/asynq.git synced 2026-04-30 17:15:53 +08:00

Add test for processor

This commit is contained in:
Ken Hibino
2019-11-29 12:48:54 -08:00
parent eed375b138
commit d53e5d3350
3 changed files with 191 additions and 12 deletions

View File

@@ -25,6 +25,14 @@ var sortMsgOpt = cmp.Transformer("SortMsg", func(in []*taskMessage) []*taskMessa
return out
})
var sortTaskOpt = cmp.Transformer("SortMsg", func(in []*Task) []*Task {
out := append([]*Task(nil), in...) // Copy input to avoid mutating it
sort.Slice(out, func(i, j int) bool {
return out[i].Type < out[j].Type
})
return out
})
// setup connects to a redis database and flush all keys
// before returning an instance of rdb.
func setup(t *testing.T) *rdb {