Commit abd2c29a authored by luxq's avatar luxq

update test

parent 18f1dd02
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
"math/rand" "math/rand"
"strconv" "strconv"
"sync"
"testing" "testing"
) )
...@@ -43,12 +44,22 @@ func TestSortSet_AddWorker(t *testing.T) { ...@@ -43,12 +44,22 @@ func TestSortSet_AddWorker(t *testing.T) {
}) })
sortSet := NewSortSet(client) sortSet := NewSortSet(client)
fmt.Println("start add worker") fmt.Println("start add worker")
w := initData() wg := sync.WaitGroup{}
for i := 0; i < len(w); i++ { for i := 0; i < 8; i++ {
if err := sortSet.AddWorker(w[i]); err != nil { wg.Add(1)
panic(fmt.Sprintf("add worker failed: %v", err)) go func(max int) {
} defer wg.Done()
count := 0
for count < max {
mid := getRandId(1000)
if err := sortSet.AddWorker(getAWorker(mid)); err != nil {
panic(fmt.Sprintf("add worker failed: %v", err))
}
count++
}
}(1000 * 100000 / 8)
} }
wg.Wait()
fmt.Println("add worker done") fmt.Println("add worker done")
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment