aboutsummaryrefslogtreecommitdiff
path: root/storage/storage_fs_test.go
blob: 429de58c4eaf23393e7f7034d0462a557a2851eb (plain)
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
package storage

import (
	"porg/testutil"
	"testing"
)

func TestWalk(t *testing.T) {
	fileCount := 1000
	folder := testutil.CreateFolder()
	files := map[string]struct{}{}
	walkedFiles := map[string]struct{}{}
	fs := NewFileSystem()

	for i := 0; i < fileCount; i++ {
		files[testutil.AppendEmptyFile(folder)] = struct{}{}
	}

	c := fs.Walk(folder, File)
	for file := range c {
		walkedFiles[file] = struct{}{}
	}

	for k := range files {
		_, ok := walkedFiles[k]
		if !ok {
			t.Errorf("File %s was not walked", k)
		}
	}
}