MCPcopy
hub / github.com/perkeep/perkeep / TestPackNormal

Function TestPackNormal

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

Source from the content-addressed store, hash-verified

153}
154
155func TestPackNormal(t *testing.T) {
156 const fileSize = 5 << 20
157 const fileName = "foo.dat"
158 fileContents := randBytes(fileSize)
159
160 hash := blob.NewHash()
161 hash.Write(fileContents)
162 wholeRef := blob.RefFromHash(hash)
163
164 pt := testPack(t,
165 func(sto blobserver.Storage) error {
166 _, err := schema.WriteFileFromReader(ctxbg, sto, fileName, bytes.NewReader(fileContents))
167 return err
168 },
169 wantNumLargeBlobs(1),
170 wantNumSmallBlobs(0),
171 )
172 // And verify we can read it back out.
173 pt.testOpenWholeRef(t, wholeRef, fileSize)
174}
175
176func TestPackNoDelete(t *testing.T) {
177 const fileSize = 1 << 20

Callers

nothing calls this directly

Calls 9

NewHashFunction · 0.92
RefFromHashFunction · 0.92
WriteFileFromReaderFunction · 0.92
randBytesFunction · 0.85
testPackFunction · 0.85
wantNumLargeBlobsFunction · 0.85
wantNumSmallBlobsFunction · 0.85
testOpenWholeRefMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected