|
@@ -19,13 +19,12 @@ import (
|
|
|
"sync"
|
|
"sync"
|
|
|
"testing"
|
|
"testing"
|
|
|
|
|
|
|
|
- "github.com/gomodule/redigo/internal/redistest"
|
|
|
|
|
"github.com/gomodule/redigo/redis"
|
|
"github.com/gomodule/redigo/redis"
|
|
|
"github.com/gomodule/redigo/redisx"
|
|
"github.com/gomodule/redigo/redisx"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func TestConnMux(t *testing.T) {
|
|
func TestConnMux(t *testing.T) {
|
|
|
- c, err := redistest.Dial()
|
|
|
|
|
|
|
+ c, err := redisx.DialTest()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatalf("error connection to database, %v", err)
|
|
t.Fatalf("error connection to database, %v", err)
|
|
|
}
|
|
}
|
|
@@ -57,7 +56,7 @@ func TestConnMux(t *testing.T) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func TestConnMuxClose(t *testing.T) {
|
|
func TestConnMuxClose(t *testing.T) {
|
|
|
- c, err := redistest.Dial()
|
|
|
|
|
|
|
+ c, err := redisx.DialTest()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatalf("error connection to database, %v", err)
|
|
t.Fatalf("error connection to database, %v", err)
|
|
|
}
|
|
}
|
|
@@ -93,7 +92,7 @@ func TestConnMuxClose(t *testing.T) {
|
|
|
|
|
|
|
|
func BenchmarkConn(b *testing.B) {
|
|
func BenchmarkConn(b *testing.B) {
|
|
|
b.StopTimer()
|
|
b.StopTimer()
|
|
|
- c, err := redistest.Dial()
|
|
|
|
|
|
|
+ c, err := redisx.DialTest()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
b.Fatalf("error connection to database, %v", err)
|
|
b.Fatalf("error connection to database, %v", err)
|
|
|
}
|
|
}
|
|
@@ -109,7 +108,7 @@ func BenchmarkConn(b *testing.B) {
|
|
|
|
|
|
|
|
func BenchmarkConnMux(b *testing.B) {
|
|
func BenchmarkConnMux(b *testing.B) {
|
|
|
b.StopTimer()
|
|
b.StopTimer()
|
|
|
- c, err := redistest.Dial()
|
|
|
|
|
|
|
+ c, err := redisx.DialTest()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
b.Fatalf("error connection to database, %v", err)
|
|
b.Fatalf("error connection to database, %v", err)
|
|
|
}
|
|
}
|
|
@@ -130,7 +129,7 @@ func BenchmarkConnMux(b *testing.B) {
|
|
|
func BenchmarkPool(b *testing.B) {
|
|
func BenchmarkPool(b *testing.B) {
|
|
|
b.StopTimer()
|
|
b.StopTimer()
|
|
|
|
|
|
|
|
- p := redis.Pool{Dial: redistest.Dial, MaxIdle: 1}
|
|
|
|
|
|
|
+ p := redis.Pool{Dial: redisx.DialTest, MaxIdle: 1}
|
|
|
defer p.Close()
|
|
defer p.Close()
|
|
|
|
|
|
|
|
// Fill the pool.
|
|
// Fill the pool.
|
|
@@ -155,7 +154,7 @@ const numConcurrent = 10
|
|
|
|
|
|
|
|
func BenchmarkConnMuxConcurrent(b *testing.B) {
|
|
func BenchmarkConnMuxConcurrent(b *testing.B) {
|
|
|
b.StopTimer()
|
|
b.StopTimer()
|
|
|
- c, err := redistest.Dial()
|
|
|
|
|
|
|
+ c, err := redisx.DialTest()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
b.Fatalf("error connection to database, %v", err)
|
|
b.Fatalf("error connection to database, %v", err)
|
|
|
}
|
|
}
|
|
@@ -186,7 +185,7 @@ func BenchmarkConnMuxConcurrent(b *testing.B) {
|
|
|
func BenchmarkPoolConcurrent(b *testing.B) {
|
|
func BenchmarkPoolConcurrent(b *testing.B) {
|
|
|
b.StopTimer()
|
|
b.StopTimer()
|
|
|
|
|
|
|
|
- p := redis.Pool{Dial: redistest.Dial, MaxIdle: numConcurrent}
|
|
|
|
|
|
|
+ p := redis.Pool{Dial: redisx.DialTest, MaxIdle: numConcurrent}
|
|
|
defer p.Close()
|
|
defer p.Close()
|
|
|
|
|
|
|
|
// Fill the pool.
|
|
// Fill the pool.
|
|
@@ -224,7 +223,7 @@ func BenchmarkPoolConcurrent(b *testing.B) {
|
|
|
|
|
|
|
|
func BenchmarkPipelineConcurrency(b *testing.B) {
|
|
func BenchmarkPipelineConcurrency(b *testing.B) {
|
|
|
b.StopTimer()
|
|
b.StopTimer()
|
|
|
- c, err := redistest.Dial()
|
|
|
|
|
|
|
+ c, err := redisx.DialTest()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
b.Fatalf("error connection to database, %v", err)
|
|
b.Fatalf("error connection to database, %v", err)
|
|
|
}
|
|
}
|