87 lines
2.0 KiB
Go
87 lines
2.0 KiB
Go
package apitest
|
|
|
|
//import (
|
|
// "github.com/rs/zerolog/log"
|
|
// "gitlab.chongshengteng.cn/bibi_service/protobuf/pb"
|
|
// "google.golang.org/protobuf/proto"
|
|
// "sync"
|
|
// "testing"
|
|
// "time"
|
|
//)
|
|
//
|
|
//func TestUserPropertyGetBench(t *testing.T) {
|
|
// //SignInTest(t)
|
|
//
|
|
// start := time.Now().UnixNano()
|
|
// t.Log("start time:", time.Now().UnixNano())
|
|
//
|
|
// for k := 0; k < 30; k++ {
|
|
// var wg sync.WaitGroup
|
|
// for i := 0; i < 8000; i++ {
|
|
// wg.Add(1)
|
|
// go UserPropertyGet(t, &wg)
|
|
// }
|
|
//
|
|
// wg.Wait()
|
|
//
|
|
// end := time.Now().UnixNano()
|
|
// duration := end - start
|
|
// t.Log("--------------------duration:", duration)
|
|
//
|
|
// time.Sleep(time.Second * 2)
|
|
// }
|
|
//
|
|
// t.Log("--------------------ok")
|
|
//
|
|
// time.Sleep(time.Second * 60)
|
|
//}
|
|
//
|
|
//func UserPropertyGet(t *testing.T, wg *sync.WaitGroup) {
|
|
// defer wg.Done()
|
|
//
|
|
// //t.Log("用户uid:", UserBase.GetUid())
|
|
// uid := UserBase.GetUid()
|
|
// userPropertyGet := &pb.ReqUserPropertyGet{
|
|
// Uid: UserBase.GetUid(),
|
|
// }
|
|
//
|
|
// reqBytes, err := proto.Marshal(userPropertyGet)
|
|
// if err != nil {
|
|
// log.Error().Msgf("err=%v", err)
|
|
// return
|
|
// }
|
|
//
|
|
// req := GetReq(pb.MsgType_UserPropertyGet, reqBytes, uid)
|
|
//
|
|
// resp, err := DoRequest(req, Token)
|
|
// if err != nil {
|
|
// t.Error(err)
|
|
// return
|
|
// }
|
|
//
|
|
// statusCode := resp.GetCode()
|
|
// if statusCode != pb.StatusCode_StatusOK {
|
|
// t.Log("状态码出错")
|
|
// t.Fail()
|
|
// return
|
|
// }
|
|
//
|
|
// respBytes := resp.GetRspBytes()
|
|
//
|
|
// var rspUserPropertyGet pb.RspUserPropertyGet
|
|
// err = proto.Unmarshal(respBytes, &rspUserPropertyGet)
|
|
// if err != nil {
|
|
// t.Error(err)
|
|
// return
|
|
// }
|
|
//
|
|
// t.Logf("UserPropertyGet=%#v", rspUserPropertyGet.String())
|
|
//
|
|
// //getUserProperty := rspUserPropertyGet.GetUserProperty()
|
|
// //getUserPropertyJson, _ := json.Marshal(getUserProperty)
|
|
// //t.Logf("getUserPropertyJson= %s", string(getUserPropertyJson))
|
|
// //t.Logf("getUserProperty.GetPoint= %#v", getUserProperty.GetPoint())
|
|
// //t.Logf("getUserProperty.GetRm= %#v", getUserProperty.GetRm())
|
|
// //t.Logf("getUserProperty.GetVm= %#v", getUserProperty.GetVm())
|
|
//}
|