MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / numFilesInDir

Function numFilesInDir

base/util_testing.go:955–970  ·  view source on GitHub ↗

numFilesInDir counts the number of files in a given directory

(t *testing.T, dir string, recursive bool)

Source from the content-addressed store, hash-verified

953
954// numFilesInDir counts the number of files in a given directory
955func numFilesInDir(t *testing.T, dir string, recursive bool) int {
956 numFiles := 0
957 err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
958 if d.Name() == filepath.Base(dir) {
959 // skip counting the root directory
960 return nil
961 }
962 if !recursive && d.IsDir() {
963 return fs.SkipDir
964 }
965 numFiles++
966 return nil
967 })
968 require.NoError(t, err)
969 return numFiles
970}
971
972// CreateTestBucketName will create a test bucket name using the test bucket prefix and the suffix you pass in
973func CreateTestBucketName(suffix string) string {

Callers 1

TestLogRotationIntervalFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by 1

TestLogRotationIntervalFunction · 0.68