MCPcopy
hub / github.com/perkeep/perkeep / TestPackTwoIdenticalfiles

Function TestPackTwoIdenticalfiles

pkg/blobserver/blobpacked/blobpacked_test.go:546–564  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

544}
545
546func TestPackTwoIdenticalfiles(t *testing.T) {
547 const fileSize = 1 << 20
548 fileContents := randBytes(fileSize)
549 testPack(t,
550 func(sto blobserver.Storage) (err error) {
551 if _, err = schema.WriteFileFromReader(ctxbg, sto, "a.txt", bytes.NewReader(fileContents)); err != nil {
552 return
553 }
554 if _, err = schema.WriteFileFromReader(ctxbg, sto, "b.txt", bytes.NewReader(fileContents)); err != nil {
555 return
556 }
557 return
558 },
559 func(pt *packTest) { pt.sto.packGate = syncutil.NewGate(1) }, // one pack at a time
560 wantNumLargeBlobs(1),
561 wantNumSmallBlobs(1), // just the "b.txt" file schema blob
562 okayWithoutMeta("sha224-8cafef47a63c2bb4f5dd6edc656c606cab803460360989c38ee2dc57"),
563 )
564}
565
566// packTest is the state kept while running func testPack.
567type packTest struct {

Callers

nothing calls this directly

Calls 6

WriteFileFromReaderFunction · 0.92
randBytesFunction · 0.85
testPackFunction · 0.85
wantNumLargeBlobsFunction · 0.85
wantNumSmallBlobsFunction · 0.85
okayWithoutMetaFunction · 0.85

Tested by

no test coverage detected