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) }