From c43fb21a0a648c7f246f27f131d364fc76576ca9 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Wed, 9 Sep 2020 19:17:56 -0700 Subject: [PATCH] Minor test updates --- inspector_test.go | 5 ++--- internal/rdb/inspect_test.go | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/inspector_test.go b/inspector_test.go index a7cb008..703833a 100644 --- a/inspector_test.go +++ b/inspector_test.go @@ -207,9 +207,8 @@ func TestInspectorHistory(t *testing.T) { Failed: (i + 1) * 10, Date: now.Add(-time.Duration(i) * 24 * time.Hour), } - // Allow 10 seconds difference in timestamp. - // When testing with Redis Cluster it could take a while to set up, and timestamp can have a few second difference. - timeCmpOpt := cmpopts.EquateApproxTime(10 * time.Second) + // Allow 2 seconds difference in timestamp. + timeCmpOpt := cmpopts.EquateApproxTime(2 * time.Second) if diff := cmp.Diff(want, got[i], timeCmpOpt); diff != "" { t.Errorf("Inspector.History %d days ago data; got %+v, want %+v; (-want,+got):\n%s", i, got[i], want, diff) diff --git a/internal/rdb/inspect_test.go b/internal/rdb/inspect_test.go index c08845d..8d7625b 100644 --- a/internal/rdb/inspect_test.go +++ b/internal/rdb/inspect_test.go @@ -272,9 +272,8 @@ func TestHistoricalStats(t *testing.T) { Failed: (i + 1) * 10, Time: now.Add(-time.Duration(i) * 24 * time.Hour), } - // Allow 10 seconds difference in timestamp. - // When testing with Redis Cluster it could take a while to set up, and timestamp can have a few second difference. - cmpOpt := cmpopts.EquateApproxTime(10 * time.Second) + // Allow 2 seconds difference in timestamp. + cmpOpt := cmpopts.EquateApproxTime(2 * time.Second) if diff := cmp.Diff(want, got[i], cmpOpt); diff != "" { t.Errorf("RDB.HistoricalStats for the last %d days; got %+v, want %+v; (-want,+got):\n%s", i, got[i], want, diff) }