镜像自地址
https://github.com/tuna/tunasync.git
已同步 2025-12-06 14:36:47 +00:00
extract mirror size from rsync provider automatically
这个提交包含在:
32
internal/util_test.go
普通文件
32
internal/util_test.go
普通文件
@@ -0,0 +1,32 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func TestExtractSizeFromRsyncLog(t *testing.T) {
|
||||
realLogContent := `
|
||||
Number of files: 998,470 (reg: 925,484, dir: 58,892, link: 14,094)
|
||||
Number of created files: 1,049 (reg: 1,049)
|
||||
Number of deleted files: 1,277 (reg: 1,277)
|
||||
Number of regular files transferred: 5,694
|
||||
Total file size: 1.33T bytes
|
||||
Total transferred file size: 2.86G bytes
|
||||
Literal data: 780.62M bytes
|
||||
Matched data: 2.08G bytes
|
||||
File list size: 37.55M
|
||||
File list generation time: 7.845 seconds
|
||||
File list transfer time: 0.000 seconds
|
||||
Total bytes sent: 7.55M
|
||||
Total bytes received: 823.25M
|
||||
|
||||
sent 7.55M bytes received 823.25M bytes 5.11M bytes/sec
|
||||
total size is 1.33T speedup is 1,604.11
|
||||
`
|
||||
Convey("Log parser should work", t, func() {
|
||||
res := ExtractSizeFromRsyncLog([]byte(realLogContent))
|
||||
So(res, ShouldEqual, "1.33T")
|
||||
})
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户