Files
mochi/storage/redis/storage_test.go
2024-05-20 18:28:40 +03:00

32 lines
681 B
Go

package redis
import (
"fmt"
"testing"
"time"
s "github.com/sot-tech/mochi/storage"
"github.com/sot-tech/mochi/storage/test"
)
var cfg = Config{
Addresses: []string{"localhost:6379"},
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
ConnectTimeout: 10 * time.Second,
}
func createNew() s.PeerStorage {
var ps s.PeerStorage
var err error
ps, err = NewStore(cfg)
if err != nil {
panic(fmt.Sprint("Unable to create Redis connection: ", err, "\nThis driver needs real Redis instance"))
}
return ps
}
func TestStorage(t *testing.T) { test.RunTests(t, createNew()) }
func BenchmarkStorage(b *testing.B) { test.RunBenchmarks(b, createNew) }