Browse Source

feat:去掉旧工具类测试

renzheng 3 years ago
parent
commit
258b62da24
3 changed files with 69 additions and 79 deletions
  1. 9 11
      go.mod
  2. 0 7
      go.sum
  3. 60 61
      redis/redis_test.go

+ 9 - 11
go.mod

@@ -3,24 +3,22 @@ module bp.jydev.jianyu360.cn/BP/redis_v2
 go 1.16
 
 require (
-	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
-	github.com/garyburd/redigo v1.6.3 // indirect
 	github.com/go-redis/redis/v8 v8.4.4
-	github.com/influxdata/influxdb-client v0.0.0-00010101000000-000000000000 // indirect
 	github.com/nitishm/go-rejson v0.0.0
-	gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
-	qfw/util v0.0.0-00010101000000-000000000000 // indirect
-	qfw/util/mongodb v0.0.0-00010101000000-000000000000 // indirect
-	qfw/util/redis v0.0.0-00010101000000-000000000000
+	//github.com/influxdata/influxdb-client v0.0.0-00010101000000-000000000000 // indirect
+	//gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
+	// qfw/util v0.0.0-00010101000000-000000000000 // indirect
+	// qfw/util/mongodb v0.0.0-00010101000000-000000000000 // indirect
+	// qfw/util/redis v0.0.0-00010101000000-000000000000
 
 )
 
 replace github.com/nitishm/go-rejson => D:/project/git/go-rejson
 
-replace qfw/util/redis => D:/project/qfw/common/src/qfw/util/redis
+// replace qfw/util/redis => D:/project/qfw/common/src/qfw/util/redis
 
-replace qfw/util/mongodb => D:/project/qfw/common/src/qfw/util/mongodb
+// replace qfw/util/mongodb => D:/project/qfw/common/src/qfw/util/mongodb
 
-replace qfw/util => D:/project/qfw/common/src/qfw/util
+// replace qfw/util => D:/project/qfw/common/src/qfw/util
 
-replace github.com/influxdata/influxdb-client => D:/project/qfw/common/src/github.com/influxdata/influxdb-client
+// replace github.com/influxdata/influxdb-client => D:/project/qfw/common/src/github.com/influxdata/influxdb-client

+ 0 - 7
go.sum

@@ -2,15 +2,11 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+
 github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
 github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f h1:q/DpyjJjZs94bziQ7YkBmIlpqbVP7yw179rnzoNVX1M=
-github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f/go.mod h1:QGrK8vMWWHQYQ3QU9bw9Y9OPNfxccGzfb41qjvVeXtY=
 github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
 github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
 github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
-github.com/garyburd/redigo v1.6.3 h1:HCeeRluvAgMusMomi1+6Y5dmFOdYV/JzoRrrbFlkGIc=
-github.com/garyburd/redigo v1.6.3/go.mod h1:rTb6epsqigu3kYKBnaF028A7Tf/Aw5s0cqA47doKKqw=
 github.com/go-redis/redis/v8 v8.4.4 h1:fGqgxCTR1sydaKI00oQf3OmkU/DIe/I/fYXvGklCIuc=
 github.com/go-redis/redis/v8 v8.4.4/go.mod h1:nA0bQuF0i5JFx4Ta9RZxGKXFrQ8cRWntra97f0196iY=
 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -77,11 +73,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
 google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
 google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
-gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
-gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

+ 60 - 61
redis/redis_test.go

@@ -8,8 +8,7 @@ import (
 	"testing"
 	"time"
 	"unsafe"
-
-	"qfw/util/redis"
+	//"qfw/util/redis"
 )
 
 func TestInit(t *testing.T) {
@@ -88,65 +87,65 @@ func randStr(n int) string {
 	return *(*string)(unsafe.Pointer(&b))
 }
 
-func Test_old_redis(t *testing.T) {
-	redis.InitRedis("other=127.0.0.1:6379")
-	chanKey := make(chan string, 50000)
-	go func() {
-		for i := 0; i < 2000000; i++ {
-			chanKey <- randStr(10)
-		}
-	}()
-
-	go func() {
-		ch := make(chan bool, 30)
-		t1 := time.Now().Unix()
-		for i := 0; i < 2000000; i++ {
-			k := <-chanKey
-			ch <- true
-			go func() {
-				defer func() {
-					<-ch
-				}()
-				redis.Put("other", k, 1, 864000)
-			}()
-			if i%20000 == 0 {
-				log.Println("current:", i)
-			}
-		}
-		log.Println("set", time.Now().Unix()-t1)
-	}()
-	select {}
-}
-
-func Test_old_redis_get(t *testing.T) {
-	redis.InitRedis("other=127.0.0.1:6379")
-	chanKey := make(chan string, 50000)
-	go func() {
-		for i := 0; i < 100000; i++ {
-			chanKey <- randStr(10)
-		}
-	}()
-
-	go func() {
-		ch := make(chan bool, 10)
-		t1 := time.Now().Unix()
-		for i := 0; i < 100000; i++ {
-			k := <-chanKey
-			ch <- true
-			go func() {
-				defer func() {
-					<-ch
-				}()
-				redis.Get("other", k)
-			}()
-			if i%20000 == 0 {
-				log.Println("current:", i)
-			}
-		}
-		log.Println("get", time.Now().Unix()-t1)
-	}()
-	select {}
-}
+// func Test_old_redis(t *testing.T) {
+// 	redis.InitRedis("other=127.0.0.1:6379")
+// 	chanKey := make(chan string, 50000)
+// 	go func() {
+// 		for i := 0; i < 2000000; i++ {
+// 			chanKey <- randStr(10)
+// 		}
+// 	}()
+
+// 	go func() {
+// 		ch := make(chan bool, 30)
+// 		t1 := time.Now().Unix()
+// 		for i := 0; i < 2000000; i++ {
+// 			k := <-chanKey
+// 			ch <- true
+// 			go func() {
+// 				defer func() {
+// 					<-ch
+// 				}()
+// 				redis.Put("other", k, 1, 864000)
+// 			}()
+// 			if i%20000 == 0 {
+// 				log.Println("current:", i)
+// 			}
+// 		}
+// 		log.Println("set", time.Now().Unix()-t1)
+// 	}()
+// 	select {}
+// }
+
+// func Test_old_redis_get(t *testing.T) {
+// 	redis.InitRedis("other=127.0.0.1:6379")
+// 	chanKey := make(chan string, 50000)
+// 	go func() {
+// 		for i := 0; i < 100000; i++ {
+// 			chanKey <- randStr(10)
+// 		}
+// 	}()
+
+// 	go func() {
+// 		ch := make(chan bool, 10)
+// 		t1 := time.Now().Unix()
+// 		for i := 0; i < 100000; i++ {
+// 			k := <-chanKey
+// 			ch <- true
+// 			go func() {
+// 				defer func() {
+// 					<-ch
+// 				}()
+// 				redis.Get("other", k)
+// 			}()
+// 			if i%20000 == 0 {
+// 				log.Println("current:", i)
+// 			}
+// 		}
+// 		log.Println("get", time.Now().Unix()-t1)
+// 	}()
+// 	select {}
+// }
 
 func Test_new_redis(t *testing.T) {
 	r1 := &GoRedis{}