mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 21:05:10 +00:00
Fix tests
This commit is contained in:
parent
9a5b9253c4
commit
91dcb958e0
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user