mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
backend: remove parameter validation tests
These parameter validations have been factored out into SemaphoreBackend.
This commit is contained in:
parent
803640ba4b
commit
45244fdf68
@ -40,11 +40,9 @@ func TestDry(t *testing.T) {
|
||||
{d, "delete", "", "", ""},
|
||||
{d, "stat", "a", "", "not found"},
|
||||
{d, "list", "", "", ""},
|
||||
{d, "save", "", "", "invalid"},
|
||||
{m, "save", "a", "baz", ""}, // save a directly to the mem backend
|
||||
{d, "save", "b", "foob", ""}, // b is not saved
|
||||
{d, "save", "b", "xxx", ""}, // no error as b is not saved
|
||||
{d, "stat", "", "", "invalid"},
|
||||
{d, "stat", "a", "a 3", ""},
|
||||
{d, "load", "a", "baz", ""},
|
||||
{d, "load", "b", "", "not found"},
|
||||
|
@ -124,17 +124,7 @@ func (s *Suite) TestLoad(t *testing.T) {
|
||||
b := s.open(t)
|
||||
defer s.close(t, b)
|
||||
|
||||
noop := func(rd io.Reader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := b.Load(context.TODO(), restic.Handle{}, 0, 0, noop)
|
||||
if err == nil {
|
||||
t.Fatalf("Load() did not return an error for invalid handle")
|
||||
}
|
||||
test.Assert(t, !b.IsNotExist(err), "IsNotExist() should not accept an invalid handle error: %v", err)
|
||||
|
||||
err = testLoad(b, restic.Handle{Type: restic.PackFile, Name: "foobar"}, 0, 0)
|
||||
err := testLoad(b, restic.Handle{Type: restic.PackFile, Name: "foobar"}, 0, 0)
|
||||
if err == nil {
|
||||
t.Fatalf("Load() did not return an error for non-existing blob")
|
||||
}
|
||||
@ -153,11 +143,6 @@ func (s *Suite) TestLoad(t *testing.T) {
|
||||
|
||||
t.Logf("saved %d bytes as %v", length, handle)
|
||||
|
||||
err = b.Load(context.TODO(), handle, 100, -1, noop)
|
||||
if err == nil {
|
||||
t.Fatalf("Load() returned no error for negative offset!")
|
||||
}
|
||||
|
||||
err = b.Load(context.TODO(), handle, 0, 0, func(rd io.Reader) error {
|
||||
_, err := io.Copy(io.Discard, rd)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user