11package redis_bloom_go
22
33import (
4+ "github.com/gomodule/redigo/redis"
5+ "github.com/stretchr/testify/assert"
46 "os"
57 "testing"
68 "time"
7- "github.com/gomodule/redigo/redis"
8- "github.com/stretchr/testify/assert"
99)
1010
11-
1211func getTestConnectionDetails () (string , string ) {
1312 value , exists := os .LookupEnv ("REDISBLOOM_TEST_HOST" )
1413 host := "localhost:6379"
@@ -32,7 +31,6 @@ func createClient() *Client {
3231 return NewClient (host , "test_client" , ptr )
3332}
3433
35-
3634func TestNewClientFromPool (t * testing.T ) {
3735 host , password := getTestConnectionDetails ()
3836 pool := & redis.Pool {Dial : func () (redis.Conn , error ) {
@@ -65,33 +63,33 @@ func TestReserve(t *testing.T) {
6563 key := "test_RESERVE"
6664 err := client .Reserve (key , 0.1 , 1000 )
6765 assert .Nil (t , err )
68-
66+
6967 info , err := client .Info (key )
7068 assert .Nil (t , err )
7169 assert .Equal (t , info , map [string ]int64 {
72- "Capacity" : 1000 ,
73- "Expansion rate" : 2 ,
74- "Number of filters" : 1 ,
75- "Number of items inserted" : 0 ,
76- "Size" : 932 ,
70+ "Capacity" : 1000 ,
71+ "Expansion rate" : 2 ,
72+ "Number of filters" : 1 ,
73+ "Number of items inserted" : 0 ,
74+ "Size" : 932 ,
7775 })
78-
76+
7977 err = client .Reserve (key , 0.1 , 1000 )
8078 assert .NotNil (t , err )
8179}
8280
8381func TestAdd (t * testing.T ) {
8482 client .FlushAll ()
8583 key := "test_ADD"
86- value := "test_ADD_value" ;
84+ value := "test_ADD_value"
8785 exists , err := client .Add (key , value )
8886 assert .Nil (t , err )
8987 assert .True (t , exists )
90-
88+
9189 info , err := client .Info (key )
9290 assert .Nil (t , err )
9391 assert .NotNil (t , info )
94-
92+
9593 exists , err = client .Add (key , value )
9694 assert .Nil (t , err )
9795 assert .False (t , exists )
@@ -100,11 +98,11 @@ func TestAdd(t *testing.T) {
10098func TestExists (t * testing.T ) {
10199 client .FlushAll ()
102100 client .Add ("test_ADD" , "test_EXISTS" )
103-
101+
104102 exists , err := client .Exists ("test_ADD" , "test_EXISTS" )
105103 assert .Nil (t , err )
106104 assert .True (t , exists )
107-
105+
108106 exists , err = client .Exists ("test_ADD" , "test_EXISTS1" )
109107 assert .Nil (t , err )
110108 assert .False (t , exists )
0 commit comments