MCPcopy
hub / github.com/perkeep/perkeep / TestReadDirs

Function TestReadDirs

pkg/schema/fileread_test.go:448–475  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

446}
447
448func TestReadDirs(t *testing.T) {
449 oldMaxStaticSetMembers := maxStaticSetMembers
450 maxStaticSetMembers = 10
451 defer func() {
452 maxStaticSetMembers = oldMaxStaticSetMembers
453 }()
454
455 // small directory, no splitting needed.
456 testReadDir(t, []*test.Blob{
457 {Contents: "AAAAAaaaaa"},
458 {Contents: "BBBBBbbbbb"},
459 {Contents: "CCCCCccccc"},
460 })
461
462 // large (over maxStaticSetMembers) directory. splitting, but no recursion needed.
463 var members []*test.Blob
464 for i := 0; i < maxStaticSetMembers+3; i++ {
465 members = append(members, &test.Blob{Contents: fmt.Sprintf("sha1-%2d", i)})
466 }
467 testReadDir(t, members)
468
469 // very large (over maxStaticSetMembers^2) directory. splitting with recursion.
470 members = nil
471 for i := 0; i < maxStaticSetMembers*maxStaticSetMembers+3; i++ {
472 members = append(members, &test.Blob{Contents: fmt.Sprintf("sha1-%3d", i)})
473 }
474 testReadDir(t, members)
475}
476
477func testReadDir(t *testing.T, members []*test.Blob) {
478 fetcher := &test.Fetcher{}

Callers

nothing calls this directly

Calls 1

testReadDirFunction · 0.85

Tested by

no test coverage detected