2021-09-17 00:01:43 +00:00
|
|
|
package store_test
|
2021-04-10 05:58:01 +00:00
|
|
|
|
2021-09-17 00:01:43 +00:00
|
|
|
import (
|
|
|
|
"testing"
|
2021-04-10 05:58:01 +00:00
|
|
|
|
2022-01-13 08:10:36 +00:00
|
|
|
"git.t-juice.club/torjus/apiary/honeypot/ssh/store"
|
2021-09-17 00:01:43 +00:00
|
|
|
)
|
2021-04-10 05:58:01 +00:00
|
|
|
|
2021-09-17 00:01:43 +00:00
|
|
|
func TestMemoryStore(t *testing.T) {
|
|
|
|
s := &store.MemoryStore{}
|
|
|
|
testLoginAttemptStore(s, t)
|
2021-04-10 05:58:01 +00:00
|
|
|
}
|
2022-09-01 01:59:18 +00:00
|
|
|
|
2021-09-17 13:00:58 +00:00
|
|
|
func TestMemoryStoreWithCache(t *testing.T) {
|
|
|
|
backend := &store.MemoryStore{}
|
|
|
|
s := store.NewCachingStore(backend)
|
|
|
|
testLoginAttemptStore(s, t)
|
|
|
|
}
|
2021-11-03 20:24:23 +00:00
|
|
|
|
|
|
|
func BenchmarkMemoryStore(b *testing.B) {
|
|
|
|
setupFunc := func() store.LoginAttemptStore {
|
|
|
|
return &store.MemoryStore{}
|
|
|
|
}
|
|
|
|
benchmarkLoginAttemptStore(setupFunc, b)
|
|
|
|
}
|
2022-09-01 01:59:18 +00:00
|
|
|
|
|
|
|
func FuzzMemoryStore(f *testing.F) {
|
|
|
|
s := &store.MemoryStore{}
|
|
|
|
fuzzLoginAttemptStore(s, f)
|
|
|
|
}
|