mirror of
https://github.com/restic/restic.git
synced 2026-09-15 08:47:57 +00:00
downgrade compress library due to regression with zero-sized blobs
while this should only affect test cases better be safe than sorry.
This commit is contained in:
@@ -80,6 +80,28 @@ func testSave(t *testing.T, version uint, calculateID bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSaveLoadZeroSizedBlob(t *testing.T) {
|
||||
repository.TestAllVersions(t, testSaveLoadZeroSizedBlob)
|
||||
}
|
||||
|
||||
func testSaveLoadZeroSizedBlob(t *testing.T, version uint) {
|
||||
repo, _, _ := repository.TestRepositoryWithVersion(t, version)
|
||||
|
||||
var data []byte
|
||||
id := restic.Hash(data)
|
||||
|
||||
rtest.OK(t, repo.WithBlobUploader(context.TODO(), func(ctx context.Context, uploader restic.BlobSaverWithAsync) error {
|
||||
sid, _, _, err := uploader.SaveBlob(ctx, restic.DataBlob, data, id, false)
|
||||
rtest.OK(t, err)
|
||||
rtest.Equals(t, id, sid)
|
||||
return nil
|
||||
}))
|
||||
|
||||
buf, err := repo.LoadBlob(context.TODO(), restic.DataBlob, id, nil)
|
||||
rtest.OK(t, err)
|
||||
rtest.Equals(t, 0, len(buf))
|
||||
}
|
||||
|
||||
func TestSavePackMerging(t *testing.T) {
|
||||
t.Run("75%", func(t *testing.T) {
|
||||
testSavePackMerging(t, 75, 1)
|
||||
|
||||
Reference in New Issue
Block a user