apiary/honeypot/ssh/store/bbolt_test.go

39 lines
665 B
Go
Raw Normal View History

2022-08-31 21:22:20 +00:00
package store_test
import (
"os"
"testing"
"git.t-juice.club/torjus/apiary/honeypot/ssh/store"
)
func TestBBoltStore(t *testing.T) {
dir := t.TempDir()
f, err := os.CreateTemp(dir, "apiary-test-bbolt")
if err != nil {
t.Fatal(err)
}
fname := f.Name()
f.Close()
s, err := store.NewBBoltStore(fname)
if err != nil {
t.Fatal(err)
}
testLoginAttemptStore(s, t)
}
2022-09-01 01:59:18 +00:00
func FuzzBBoltStore(f *testing.F) {
dir := f.TempDir()
file, err := os.CreateTemp(dir, "apiary-test-bbolt")
if err != nil {
f.Fatal(err)
}
fname := file.Name()
file.Close()
s, err := store.NewBBoltStore(fname)
if err != nil {
f.Fatal(err)
}
fuzzLoginAttemptStore(s, f)
}