forked from beyondstorage/go-service-fs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreaddir_linux_test.go
More file actions
61 lines (50 loc) · 852 Bytes
/
readdir_linux_test.go
File metadata and controls
61 lines (50 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package fs
import (
"io/ioutil"
"testing"
"github.com/beyondstorage/go-storage/v4/types"
"github.com/stretchr/testify/assert"
)
func fsReaddir(b *testing.B) {
s, _ := newStorager()
it, err := s.List("/usr/lib")
if err != nil {
b.Error(err)
}
for {
_, err := it.Next()
if err == types.IterateDone {
break
}
}
}
func osReaddir(b *testing.B) {
_, err := ioutil.ReadDir("/usr/lib")
if err != nil {
b.Error(err)
}
}
func TestGetFilesFs(t *testing.T) {
s, _ := newStorager()
it, err := s.List("/usr/lib")
if err != nil {
t.Error(err)
}
for {
o, err := it.Next()
if err == types.IterateDone {
break
}
assert.NotNil(t, o)
}
}
func BenchmarkGetFilesFs(b *testing.B) {
for i := 0; i < b.N; i++ {
fsReaddir(b)
}
}
func BenchmarkGetFilesOs(b *testing.B) {
for i := 0; i < b.N; i++ {
osReaddir(b)
}
}