mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 14:56:29 +00:00
backend tests load: Use reader with Size() method
This commit is contained in:
parent
c7209ef231
commit
4ac0d3ad40
@ -277,7 +277,8 @@ func BackendTestLoad(t testing.TB, s *Suite) {
|
||||
|
||||
type errorCloser struct {
|
||||
io.Reader
|
||||
t testing.TB
|
||||
size int64
|
||||
t testing.TB
|
||||
}
|
||||
|
||||
func (ec errorCloser) Close() error {
|
||||
@ -285,6 +286,10 @@ func (ec errorCloser) Close() error {
|
||||
return errors.New("forbidden method close was called")
|
||||
}
|
||||
|
||||
func (ec errorCloser) Size() int64 {
|
||||
return ec.size
|
||||
}
|
||||
|
||||
// BackendTestSave tests saving data in the backend.
|
||||
func BackendTestSave(t testing.TB, s *Suite) {
|
||||
b := s.open(t)
|
||||
@ -354,7 +359,7 @@ func BackendTestSave(t testing.TB, s *Suite) {
|
||||
|
||||
// wrap the tempfile in an errorCloser, so we can detect if the backend
|
||||
// closes the reader
|
||||
err = b.Save(h, errorCloser{t: t, Reader: tmpfile})
|
||||
err = b.Save(h, errorCloser{t: t, size: int64(length), Reader: tmpfile})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user