test1_test.go 1012 B

123456789101112131415161718192021222324252627282930313233343536
  1. package test
  2. import (
  3. "context"
  4. "flag"
  5. "github.com/tal-tech/go-zero/core/conf"
  6. "github.com/tal-tech/go-zero/zrpc"
  7. "log"
  8. "app.yhyue.com/moapp/jyPoints/rpc/integral"
  9. "app.yhyue.com/moapp/jyPoints/rpc/integralclient"
  10. "app.yhyue.com/moapp/jyPoints/rpc/internal/config"
  11. "testing"
  12. "time"
  13. )
  14. var configFile = flag.String("f", "integral.yaml", "the config file")
  15. var c config.Config
  16. func init() {
  17. conf.MustLoad(*configFile, &c)
  18. }
  19. /*func Test_add(t *testing.T) {
  20. var c config.Config
  21. conf.MustLoad(*configFile, &c)
  22. ctx := svc.NewServiceContext(c)
  23. srv := server.NewAdderServer(ctx)
  24. fmt.Println(srv.Add(context.Background(), &add.AddReq{Book: "lz-zero",Price:120}))
  25. }*/
  26. func Test_add(t *testing.T) {
  27. ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
  28. FileSystem :=integralclient.NewIntegral(zrpc.MustNewClient(c.FileSystemConf))
  29. req := &integral.Req{UserId: "xzh", Point: 123}
  30. res, err := FileSystem.IntegralBalanceCheck(ctx, req)
  31. log.Println("err ", err)
  32. log.Println("req ", res)
  33. }