MCPcopy Index your code
hub / github.com/perkeep/perkeep / TestBasicStreaming

Function TestBasicStreaming

pkg/blobserver/diskpacked/stream_test.go:156–171  ·  view source on GitHub ↗

Tests the streaming of all blobs in a storage, with hash verification.

(t *testing.T)

Source from the content-addressed store, hash-verified

154
155// Tests the streaming of all blobs in a storage, with hash verification.
156func TestBasicStreaming(t *testing.T) {
157 s, clean := newTestStorage(t, pack{testPack1})
158 defer clean()
159
160 expected := len(testPack1)
161 blobs := streamAll(t, s)
162 if len(blobs) != expected {
163 t.Fatalf("Wrong blob count: Expected %d, got %d", expected,
164 len(blobs))
165 }
166 wantRefs := make([]blob.SizedRef, len(blobs))
167 for i, b := range blobs {
168 wantRefs[i] = b.SizedRef()
169 }
170 storagetest.TestStreamer(t, s, storagetest.WantSizedRefs(wantRefs))
171}
172
173func verifySizeAndHash(t *testing.T, blob *blob.Blob) {
174 hash := sha1.New()

Callers

nothing calls this directly

Calls 6

TestStreamerFunction · 0.92
WantSizedRefsTypeAlias · 0.92
streamAllFunction · 0.85
newTestStorageFunction · 0.70
FatalfMethod · 0.65
SizedRefMethod · 0.45

Tested by

no test coverage detected