2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

Fix tests

This commit is contained in:
Alexander Neumann 2017-01-13 12:40:03 +01:00
parent 9a5b9253c4
commit 91dcb958e0
3 changed files with 6 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"io"
"math/rand"
"restic"
"restic/crypto"
"restic/repository"
"testing"
)
@ -44,7 +45,7 @@ func checkSavedFile(t *testing.T, repo restic.Repository, treeID restic.ID, name
t.Fatal(err)
}
buf := make([]byte, int(size))
buf := make([]byte, int(size), int(size)+crypto.Extension)
n := loadBlob(t, repo, id, buf)
if n != len(buf) {
t.Errorf("wrong number of bytes read, want %d, got %d", len(buf), n)

View File

@ -10,6 +10,7 @@ import (
"syscall"
"time"
"restic/crypto"
"restic/errors"
"runtime"
@ -208,7 +209,7 @@ func (node Node) createFileAt(path string, repo Repository) error {
buf = buf[:cap(buf)]
if uint(len(buf)) < size {
buf = make([]byte, size)
buf = make([]byte, size, size+crypto.Extension)
}
n, err := repo.LoadBlob(DataBlob, id, buf)

View File

@ -41,7 +41,7 @@ func TestSave(t *testing.T) {
// OK(t, repo.SaveIndex())
// read back
buf := make([]byte, size)
buf := make([]byte, size, size+crypto.Extension)
n, err := repo.LoadBlob(restic.DataBlob, id, buf)
OK(t, err)
Equals(t, len(buf), n)
@ -75,7 +75,7 @@ func TestSaveFrom(t *testing.T) {
OK(t, repo.Flush())
// read back
buf := make([]byte, size)
buf := make([]byte, size, size+crypto.Extension)
n, err := repo.LoadBlob(restic.DataBlob, id, buf)
OK(t, err)
Equals(t, len(buf), n)