backend/tests: Correct error message and delayed remove

This commit is contained in:
Alexander Neumann 2017-06-15 20:05:35 +02:00
parent bbca31b661
commit 05365706c0

View file

@ -446,9 +446,15 @@ func delayedRemove(b restic.Backend, h restic.Handle) error {
found, err := b.Test(context.TODO(), h) found, err := b.Test(context.TODO(), h)
for i := 0; found && i < 20; i++ { for i := 0; found && i < 20; i++ {
found, err = b.Test(context.TODO(), h) found, err = b.Test(context.TODO(), h)
if found { if err != nil {
time.Sleep(100 * time.Millisecond) return err
} }
if !found {
break
}
time.Sleep(100 * time.Millisecond)
} }
return err return err
} }
@ -591,7 +597,7 @@ func (s *Suite) TestBackend(t *testing.T) {
found, err = b.Test(context.TODO(), h) found, err = b.Test(context.TODO(), h)
test.OK(t, err) test.OK(t, err)
test.Assert(t, !found, fmt.Sprintf("id %q not found after removal", id)) test.Assert(t, !found, fmt.Sprintf("id %q found after removal", id))
} }
} }
} }