12345678910111213141516171819202122232425262728293031323334353637383940 |
- package test
- import (
- "context"
- "log"
- "testing"
- "time"
- ordercenterclient "bp.jydev.jianyu360.cn/BaseService/orderCenter/rpc/ordercenter"
- "bp.jydev.jianyu360.cn/BaseService/orderCenter/rpc/pb"
- "github.com/zeromicro/go-zero/zrpc"
- "github.com/zeromicro/go-zero/core/conf"
- )
- type Config struct {
- FileSystemConf zrpc.RpcClientConf
- }
- var c Config
- func init() {
- conf.MustLoad("ordercenter.yaml", &c)
- }
- // go test -v -run Test_OrderList
- func Test_OrderList(t *testing.T) {
- ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
- FileSystem := ordercenterclient.NewOrderCenter(zrpc.MustNewClient(c.FileSystemConf))
- req := &pb.OrderListReq{
- Appid: "10000",
- UserId: 1,
- DataType: 2,
- PageNum: 1,
- PageSize: 10,
- }
- res, err := FileSystem.OrderList(ctx, req)
- log.Println("err ", err)
- log.Println("res:", res)
- }
|