mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
test the GetReader() function
This commit is contained in:
parent
05e2afba0b
commit
513be4b8ab
@ -31,6 +31,10 @@ func testBackend(b backend.Backend, t *testing.T) {
|
||||
_, err = b.Get(tpe, id.String())
|
||||
Assert(t, err != nil, "blob data could be extracted before creation")
|
||||
|
||||
// try to read not existing blob
|
||||
_, err = b.GetReader(tpe, id.String(), 0, 1)
|
||||
Assert(t, err != nil, "blob reader could be obtained before creation")
|
||||
|
||||
// try to get string out, should fail
|
||||
ret, err = b.Test(tpe, id.String())
|
||||
OK(t, err)
|
||||
@ -52,6 +56,11 @@ func testBackend(b backend.Backend, t *testing.T) {
|
||||
OK(t, err)
|
||||
Assert(t, rd != nil, "Get() returned nil")
|
||||
|
||||
// try to read it out again
|
||||
r, err := b.GetReader(tpe, test.id, 0, uint(len(test.data)))
|
||||
OK(t, err)
|
||||
Assert(t, r != nil, "GetReader() returned nil")
|
||||
|
||||
buf, err := ioutil.ReadAll(rd)
|
||||
OK(t, err)
|
||||
Equals(t, test.data, string(buf))
|
||||
|
Loading…
Reference in New Issue
Block a user