|
@@ -0,0 +1,36 @@
|
|
|
+package test
|
|
|
+
|
|
|
+import (
|
|
|
+ "context"
|
|
|
+ "flag"
|
|
|
+ "github.com/tal-tech/go-zero/core/conf"
|
|
|
+ "github.com/tal-tech/go-zero/zrpc"
|
|
|
+ "log"
|
|
|
+ "points_service/rpc/integral"
|
|
|
+ "points_service/rpc/integralclient"
|
|
|
+ "points_service/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.AddReq{UserId: "xzh", CountPoints: 123}
|
|
|
+ res, err := FileSystem.IntegralBalanceCheck(ctx, req)
|
|
|
+ log.Println("err ", err)
|
|
|
+ log.Println("req ", res)
|
|
|
+}
|