mirror of
https://github.com/hibiken/asynq.git
synced 2024-12-27 00:02:19 +08:00
Minor test updates
This commit is contained in:
parent
a293efcdab
commit
c43fb21a0a
@ -207,9 +207,8 @@ func TestInspectorHistory(t *testing.T) {
|
|||||||
Failed: (i + 1) * 10,
|
Failed: (i + 1) * 10,
|
||||||
Date: now.Add(-time.Duration(i) * 24 * time.Hour),
|
Date: now.Add(-time.Duration(i) * 24 * time.Hour),
|
||||||
}
|
}
|
||||||
// Allow 10 seconds difference in timestamp.
|
// Allow 2 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(2 * time.Second)
|
||||||
timeCmpOpt := cmpopts.EquateApproxTime(10 * time.Second)
|
|
||||||
if diff := cmp.Diff(want, got[i], timeCmpOpt); diff != "" {
|
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",
|
t.Errorf("Inspector.History %d days ago data; got %+v, want %+v; (-want,+got):\n%s",
|
||||||
i, got[i], want, diff)
|
i, got[i], want, diff)
|
||||||
|
@ -272,9 +272,8 @@ func TestHistoricalStats(t *testing.T) {
|
|||||||
Failed: (i + 1) * 10,
|
Failed: (i + 1) * 10,
|
||||||
Time: now.Add(-time.Duration(i) * 24 * time.Hour),
|
Time: now.Add(-time.Duration(i) * 24 * time.Hour),
|
||||||
}
|
}
|
||||||
// Allow 10 seconds difference in timestamp.
|
// Allow 2 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(2 * time.Second)
|
||||||
cmpOpt := cmpopts.EquateApproxTime(10 * time.Second)
|
|
||||||
if diff := cmp.Diff(want, got[i], cmpOpt); diff != "" {
|
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)
|
t.Errorf("RDB.HistoricalStats for the last %d days; got %+v, want %+v; (-want,+got):\n%s", i, got[i], want, diff)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user