mirror of
https://github.com/sot-tech/mochi.git
synced 2026-04-26 07:30:00 -07:00
32 lines
681 B
Go
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) }
|