Change store All to use channel

This commit is contained in:
2022-08-26 12:21:52 +02:00
parent 4c77b5ef9b
commit 07fe16b72a
6 changed files with 52 additions and 22 deletions

View File

@@ -25,8 +25,12 @@ func testLoginAttemptStore(s store.LoginAttemptStore, t *testing.T) {
if err != nil {
t.Fatalf("Error getting all attempts: %s", err)
}
if len(all) != len(testAttempts) {
t.Errorf("All returned wrong amount. Got %d want %d", len(all), len(testAttempts))
var count int
for range all {
count++
}
if count != len(testAttempts) {
t.Errorf("All returned wrong amount. Got %d want %d", count, len(testAttempts))
}
stats, err := s.Stats(store.LoginStatsTotals, 1)
if err != nil {
@@ -229,7 +233,11 @@ func benchmarkLoginAttemptStore(setupFunc func() store.LoginAttemptStore, b *tes
if err != nil {
b.Fatalf("Error fetchin all: %s", err)
}
_ = len(all)
var count int
for range all {
count++
}
_ = count
}
})
}