fix: CurrentState without processed/failed data

This commit is contained in:
Ken Hibino
2019-12-25 21:29:20 -08:00
parent 9b87f7c1f1
commit fb24d158ae
3 changed files with 75 additions and 23 deletions

View File

@@ -138,6 +138,30 @@ func TestCurrentStats(t *testing.T) {
}
}
func TestCurrentStatsWithoutData(t *testing.T) {
r := setup(t)
want := &Stats{
Enqueued: 0,
InProgress: 0,
Scheduled: 0,
Retry: 0,
Dead: 0,
Processed: 0,
Failed: 0,
Timestamp: time.Now(),
}
got, err := r.CurrentStats()
if err != nil {
t.Fatalf("r.CurrentStats() = %v, %v, want %+v, nil", got, err, want)
}
if diff := cmp.Diff(want, got, timeCmpOpt); diff != "" {
t.Errorf("r.CurrentStats() = %v, %v, want %+v, nil; (-want, +got)\n%s", got, err, want, diff)
}
}
func TestRedisInfo(t *testing.T) {
r := setup(t)