|
@@ -6,10 +6,11 @@ import (
|
|
|
"testing"
|
|
|
"time"
|
|
|
|
|
|
+ "os"
|
|
|
+
|
|
|
"app.yhyue.com/moapp/jyfs/rpc/filesystem"
|
|
|
"app.yhyue.com/moapp/jyfs/rpc/filesystemclient"
|
|
|
"app.yhyue.com/moapp/jyfs/rpc/internal/config"
|
|
|
-
|
|
|
"github.com/tal-tech/go-zero/core/conf"
|
|
|
"github.com/tal-tech/go-zero/zrpc"
|
|
|
)
|
|
@@ -40,6 +41,16 @@ func Test_DeleteDomain(t *testing.T) {
|
|
|
log.Println("req ", res)
|
|
|
}
|
|
|
|
|
|
+// 更新域
|
|
|
+func Test_UpdateDomainMeta(t *testing.T) {
|
|
|
+ ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
|
|
|
+ FileSystem := filesystemclient.NewFileSystem(zrpc.MustNewClient(C.FileSystemConf))
|
|
|
+ req := &filesystem.DomainReq{Name: "xzh", MetaFields: []string{"docName", "docSuffix", "docSize", "docPage"}}
|
|
|
+ res, err := FileSystem.UpdateDomainMeta(ctx, req)
|
|
|
+ log.Println("err ", err)
|
|
|
+ log.Println("req ", res)
|
|
|
+}
|
|
|
+
|
|
|
// 删除文件
|
|
|
func Test_DeleteFile(t *testing.T) {
|
|
|
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
|
|
@@ -76,21 +87,21 @@ func Test_SaveFile(t *testing.T) {
|
|
|
FileSystem := filesystemclient.NewFileSystem(zrpc.MustNewClient(C.FileSystemConf))
|
|
|
file, err := os.Open("./111.txt")
|
|
|
if err != nil {
|
|
|
- return nil, err
|
|
|
+ return
|
|
|
}
|
|
|
defer file.Close()
|
|
|
// FileInfo:
|
|
|
stats, err := file.Stat()
|
|
|
if err != nil {
|
|
|
- return nil, err
|
|
|
+ return
|
|
|
}
|
|
|
// []byte
|
|
|
data := make([]byte, stats.Size())
|
|
|
count, err := file.Read(data)
|
|
|
if err != nil {
|
|
|
- return nil, err
|
|
|
+ return
|
|
|
}
|
|
|
- fmt.Println(count)
|
|
|
+ log.Println(count)
|
|
|
req := &filesystem.SaveFileReq{
|
|
|
Domain: "xzh",
|
|
|
FileId: "111.txt",
|