2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-11-10 11:31:58 +08:00

Minor test updates

This commit is contained in:
Ken Hibino 2020-09-09 19:17:56 -07:00
parent a293efcdab
commit c43fb21a0a
2 changed files with 4 additions and 6 deletions

View File

@ -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)

View File

@ -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)
}