123456789101112131415161718192021222324252627282930313233343536 |
- package test
- import (
- "context"
- "flag"
- "github.com/tal-tech/go-zero/core/conf"
- "github.com/tal-tech/go-zero/zrpc"
- "log"
- "app.yhyue.com/moapp/jyPoints/rpc/integral"
- "app.yhyue.com/moapp/jyPoints/rpc/integralclient"
- "app.yhyue.com/moapp/jyPoints/rpc/internal/config"
- "testing"
- "time"
- )
- var configFile = flag.String("f", "integral.yaml", "the config file")
- var c config.Config
- func init() {
- conf.MustLoad(*configFile, &c)
- }
- /*func Test_add(t *testing.T) {
- var c config.Config
- conf.MustLoad(*configFile, &c)
- ctx := svc.NewServiceContext(c)
- srv := server.NewAdderServer(ctx)
- fmt.Println(srv.Add(context.Background(), &add.AddReq{Book: "lz-zero",Price:120}))
- }*/
- func Test_add(t *testing.T) {
- ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
- FileSystem :=integralclient.NewIntegral(zrpc.MustNewClient(c.FileSystemConf))
- req := &integral.Req{UserId: "xzh", Point: 123}
- res, err := FileSystem.IntegralBalanceCheck(ctx, req)
- log.Println("err ", err)
- log.Println("req ", res)
- }
|