From 05365706c094be501b0765aa2f904c39bdcf4520 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 15 Jun 2017 20:05:35 +0200 Subject: [PATCH] backend/tests: Correct error message and delayed remove --- src/restic/backend/test/tests.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/restic/backend/test/tests.go b/src/restic/backend/test/tests.go index a4d179dd9..4447064cf 100644 --- a/src/restic/backend/test/tests.go +++ b/src/restic/backend/test/tests.go @@ -446,9 +446,15 @@ func delayedRemove(b restic.Backend, h restic.Handle) error { found, err := b.Test(context.TODO(), h) for i := 0; found && i < 20; i++ { found, err = b.Test(context.TODO(), h) - if found { - time.Sleep(100 * time.Millisecond) + if err != nil { + return err } + + if !found { + break + } + + time.Sleep(100 * time.Millisecond) } return err } @@ -591,7 +597,7 @@ func (s *Suite) TestBackend(t *testing.T) { found, err = b.Test(context.TODO(), h) 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)) } } }