-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathztest_test.go
More file actions
39 lines (35 loc) · 819 Bytes
/
ztest_test.go
File metadata and controls
39 lines (35 loc) · 819 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
package brimcap
import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
"testing"
"github.com/brimdata/zed/ztest"
"github.com/stretchr/testify/require"
)
func TestBrimcap(t *testing.T) {
t.Parallel()
dirs, err := findZTests()
require.NoError(t, err)
for d := range dirs {
d := d
t.Run(filepath.ToSlash(d), func(t *testing.T) {
t.Parallel()
ztest.Run(t, d)
})
}
}
func findZTests() (map[string]struct{}, error) {
dirs := map[string]struct{}{}
pattern := fmt.Sprintf(`.*ztests\%c.*\.yaml$`, filepath.Separator)
re := regexp.MustCompile(pattern)
err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
if !info.IsDir() && strings.HasSuffix(path, ".yaml") && re.MatchString(path) {
dirs[filepath.Dir(path)] = struct{}{}
}
return err
})
return dirs, err
}