2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

master_index: fix inconsistent length blob length in test

Two blobs with the same hash must always have the same content length.
This commit is contained in:
Michael Eischer 2023-08-19 20:04:22 +02:00
parent e60c5b2d7f
commit 2bec99dc6f

View File

@ -43,9 +43,10 @@ func TestMasterIndex(t *testing.T) {
blob12a := restic.PackedBlob{ blob12a := restic.PackedBlob{
PackID: restic.NewRandomID(), PackID: restic.NewRandomID(),
Blob: restic.Blob{ Blob: restic.Blob{
BlobHandle: bhInIdx12, BlobHandle: bhInIdx12,
Length: uint(crypto.CiphertextLength(123)), Length: uint(crypto.CiphertextLength(123)),
Offset: 110, Offset: 110,
UncompressedLength: 80,
}, },
} }
@ -116,7 +117,7 @@ func TestMasterIndex(t *testing.T) {
size, found = mIdx.LookupSize(bhInIdx12) size, found = mIdx.LookupSize(bhInIdx12)
rtest.Equals(t, true, found) rtest.Equals(t, true, found)
rtest.Equals(t, uint(123), size) rtest.Equals(t, uint(80), size)
// test not in index // test not in index
found = mIdx.Has(restic.BlobHandle{ID: restic.NewRandomID(), Type: restic.TreeBlob}) found = mIdx.Has(restic.BlobHandle{ID: restic.NewRandomID(), Type: restic.TreeBlob})