mirror of
https://github.com/kopia/kopia.git
synced 2026-10-27 16:48:59 -04:00
Fixed few coverage flakes (#872)
* blobtesting: coverage for GetMetadata() returning ErrNotFound * content: additional direct coverage for diskCommittedContentIndexCache
This commit is contained in:
1 parent
a6e96c31f8
commit
b6e68fa28a
3 files changed
+16
No files matched your search
@@ -92,6 +92,16 @@ func AssertGetBlobNotFound(ctx context.Context, t testingT, s blob.Storage, blob
|
||||
}
|
||||
}
|
||||
|
||||
// AssertGetMetadataNotFound asserts that GetMetadata() for specified blobID returns ErrNotFound.
|
||||
func AssertGetMetadataNotFound(ctx context.Context, t testingT, s blob.Storage, blobID blob.ID) {
|
||||
t.Helper()
|
||||
|
||||
_, err := s.GetMetadata(ctx, blobID)
|
||||
if !errors.Is(err, blob.ErrBlobNotFound) {
|
||||
t.Errorf("GetMetadata(%v) returned %v, %v but expected ErrNotFound", blobID, err)
|
||||
}
|
||||
}
|
||||
|
||||
// AssertListResults asserts that the list results with given prefix return the specified list of names in order.
|
||||
func AssertListResults(ctx context.Context, t testingT, s blob.Storage, prefix blob.ID, want ...blob.ID) {
|
||||
t.Helper()
|
||||
|
||||
@@ -30,6 +30,7 @@ func VerifyStorage(ctx context.Context, t testingT, r blob.Storage) {
|
||||
// First verify that blocks don't exist.
|
||||
for _, b := range blocks {
|
||||
AssertGetBlobNotFound(ctx, t, r, b.blk)
|
||||
AssertGetMetadataNotFound(ctx, t, r, b.blk)
|
||||
}
|
||||
|
||||
if err := r.DeleteBlob(ctx, "no-such-blob"); err != nil && !errors.Is(err, blob.ErrBlobNotFound) {
|
||||
|
||||
@@ -59,6 +59,11 @@ func testCache(t *testing.T, cache committedContentIndexCache, fakeTime *faketim
|
||||
"c4": &Info{PackBlobID: "p2345", ID: "c4"},
|
||||
})))
|
||||
|
||||
must(t, cache.addContentToCache(ctx, "ndx2", mustBuildPackIndex(t, packIndexBuilder{
|
||||
"c3": &Info{PackBlobID: "p2345", ID: "c3"},
|
||||
"c4": &Info{PackBlobID: "p2345", ID: "c4"},
|
||||
})))
|
||||
|
||||
ndx1, err := cache.openIndex(ctx, "ndx1")
|
||||
must(t, err)
|
||||
|
||||
|
||||
Reference in new issue
Block a user