2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-09-20 02:55:54 +08:00

Fix flaky test

This commit is contained in:
Ken Hibino 2021-09-12 16:56:22 -07:00
parent 9e2f88c00d
commit 4638405cbd

View File

@ -436,7 +436,8 @@ func TestDequeue(t *testing.T) {
}
for queue, want := range tc.wantDeadlines {
gotDeadlines := h.GetDeadlinesEntries(t, r.client, queue)
if diff := cmp.Diff(want, gotDeadlines, h.SortZSetEntryOpt); diff != "" {
cmpOpts := []cmp.Option{h.SortZSetEntryOpt, h.EquateInt64Approx(2)} // allow up to 2 second margin in Score
if diff := cmp.Diff(want, gotDeadlines, cmpOpts...); diff != "" {
t.Errorf("mismatch found in %q: (-want,+got):\n%s", base.DeadlinesKey(queue), diff)
}
}