package Test import ( "context" "dsBaseRpc/RpcService/{{.tableName}}/{{.tableName}}Proto" "dsBaseRpc/Utils/GRpcUtil" "fmt" "log" "testing" "time" ) /* 功能:{{.description}} 作者:{{.authorName}} 时间:{{.currenttime}} */ func Test{{.interfaceName}}(t *testing.T) { //1、准备动作:连接服务器 ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() conn:= GRpcUtil.GetConnection() defer conn.Close() //2、使用微服务 c := {{.tableName}}Proto.New{{.tableName}}ManageClient(conn) r, err := c.{{.interfaceName}}(ctx, &{{.tableName}}Proto.{{.struct_name}}{ {{.RpcServiceParameters}}} ) if err != nil { log.Fatalf("could not greet: %v", err) } fmt.Println(r.Message, r.Success, r.Count) fmt.Println(r.List) }