| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package main
- import (
- "f1-game/tool/client-cli/cli"
- "fmt"
- "math/rand"
- "sync"
- "testing"
- "time"
- cherryHttp "github.com/cherry-game/cherry/extend/http"
- )
- func TestRegisterDevAccount(t *testing.T) {
- var (
- url = "http://172.16.124.91"
- )
- accountList := make(map[string]string)
- for i := 1; i <= 10000; i++ {
- key := fmt.Sprintf("susu%d", i)
- accountList[key] = key
- }
- cli.RegisterDevAccounts(url, accountList)
- }
- func TestConnect(t *testing.T) {
- var (
- url = "http://172.16.124.91"
- addr = "172.16.124.91:21000"
- pid = "2188001"
- )
- wg := sync.WaitGroup{}
- wg.Add(1)
- maxAccountNum := 100000
- accountList := make(map[string]string)
- for i := 1; i <= maxAccountNum; i++ {
- key := fmt.Sprintf("test%d", i)
- accountList[key] = key
- }
- for userName, password := range accountList {
- time.Sleep(time.Duration(rand.Int31n(5)) * time.Millisecond)
- go cli.RunRobotConnect(url, pid, userName, password, addr)
- }
- wg.Wait()
- }
- func BenchmarkCenterPing(b *testing.B) {
- reqURL := "http://127.0.0.1/test/ping-center"
- for i := 0; i < b.N; i++ {
- cherryHttp.GET(reqURL)
- }
- }
|