-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrpp_test.go
More file actions
39 lines (30 loc) · 801 Bytes
/
Copy pathrpp_test.go
File metadata and controls
39 lines (30 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package rpp
import (
"testing"
"github.com/garyburd/redigo/redis"
"github.com/rafaeljusto/redigomock"
)
func TestRPP(t *testing.T) {
testConn := redigomock.NewConn()
// Register our commands
authCmd := testConn.Command("AUTH", "foo").ExpectStringSlice("ok")
selectCmd := testConn.Command("SELECT", 5).ExpectStringSlice("ok")
dialFn = func(_ string) (redis.Conn, error) {
return testConn, nil
}
var (
err error
rpp *redis.Pool
)
if rpp, err = RPP("redis://x:foo@10.10.10.10:8443/5", 5, 5); err != nil {
t.Error("failed to create rpp: ", err)
t.Fail()
}
_ = rpp.Get()
if testConn.Stats(authCmd) != 1 {
t.Error("connection was not successfully authenticated")
}
if testConn.Stats(selectCmd) != 1 {
t.Error("connection did not successfully select desired DB")
}
}