mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-20 20:22:46 +00:00
fix util_test
This commit is contained in:
parent
70cb22096f
commit
2c33380ce0
@ -1,6 +1,9 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
@ -26,7 +29,14 @@ 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))
|
||||
tmpDir, err := ioutil.TempDir("", "tunasync")
|
||||
So(err, ShouldBeNil)
|
||||
defer os.RemoveAll(tmpDir)
|
||||
logFile := filepath.Join(tmpDir, "rs.log")
|
||||
err = ioutil.WriteFile(logFile, []byte(realLogContent), 0755)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
res := ExtractSizeFromRsyncLog(logFile)
|
||||
So(res, ShouldEqual, "1.33T")
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user