MCPcopy
hub / github.com/perkeep/perkeep / TestStreamSkipRemovedBlobs

Function TestStreamSkipRemovedBlobs

pkg/blobserver/diskpacked/stream_test.go:201–225  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

199}
200
201func TestStreamSkipRemovedBlobs(t *testing.T) {
202 ctx := context.Background()
203 // Note: This is the only streaming test that makes use of the
204 // index (for RemoveBlobs() to succeed). The others do create
205 // an indexed storage but they do not use the index to stream
206 // (nor should they use it). The streaming in this test is
207 // done by reading the underlying diskpacks.
208 s := newTempDiskpacked(t)
209
210 uploadTestBlobs(t, s, testPack1)
211
212 ref, ok := blob.Parse(testPack1[0].digest)
213 if !ok {
214 t.Fatalf("blob.Parse: %s", testPack1[0].digest)
215 }
216
217 err := s.RemoveBlobs(ctx, []blob.Ref{ref})
218 if err != nil {
219 t.Fatalf("RemoveBlobs: %v", err)
220 }
221
222 diskpackedSto := s.(*storage)
223 expected := len(testPack1) - 1 // We've deleted 1
224 storagetest.TestStreamer(t, diskpackedSto, storagetest.WantN(expected))
225}

Callers

nothing calls this directly

Calls 7

ParseFunction · 0.92
TestStreamerFunction · 0.92
WantNTypeAlias · 0.92
newTempDiskpackedFunction · 0.85
uploadTestBlobsFunction · 0.85
FatalfMethod · 0.65
RemoveBlobsMethod · 0.65

Tested by

no test coverage detected