From 4638405cbdb39574eab9fc9c07c0f7d750dcb75e Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Sun, 12 Sep 2021 16:56:22 -0700 Subject: [PATCH] Fix flaky test --- internal/rdb/rdb_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/rdb/rdb_test.go b/internal/rdb/rdb_test.go index 87a29c4..233000e 100644 --- a/internal/rdb/rdb_test.go +++ b/internal/rdb/rdb_test.go @@ -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) } }