From 4ac0d3ad4012ac09da5e77049c3d159ca4871319 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 13 May 2017 19:56:11 +0200 Subject: [PATCH] backend tests load: Use reader with Size() method --- src/restic/backend/test/tests.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/restic/backend/test/tests.go b/src/restic/backend/test/tests.go index 4519ee25c..65b7d8978 100644 --- a/src/restic/backend/test/tests.go +++ b/src/restic/backend/test/tests.go @@ -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) }