util_test.go 880 B

1234567891011121314151617181920212223242526272829303132
  1. package internal
  2. import (
  3. "testing"
  4. . "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestExtractSizeFromRsyncLog(t *testing.T) {
  7. realLogContent := `
  8. Number of files: 998,470 (reg: 925,484, dir: 58,892, link: 14,094)
  9. Number of created files: 1,049 (reg: 1,049)
  10. Number of deleted files: 1,277 (reg: 1,277)
  11. Number of regular files transferred: 5,694
  12. Total file size: 1.33T bytes
  13. Total transferred file size: 2.86G bytes
  14. Literal data: 780.62M bytes
  15. Matched data: 2.08G bytes
  16. File list size: 37.55M
  17. File list generation time: 7.845 seconds
  18. File list transfer time: 0.000 seconds
  19. Total bytes sent: 7.55M
  20. Total bytes received: 823.25M
  21. sent 7.55M bytes received 823.25M bytes 5.11M bytes/sec
  22. total size is 1.33T speedup is 1,604.11
  23. `
  24. Convey("Log parser should work", t, func() {
  25. res := ExtractSizeFromRsyncLog([]byte(realLogContent))
  26. So(res, ShouldEqual, "1.33T")
  27. })
  28. }