From 68370feeee702353c5b5069cd7d0e77945974333 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 15 Aug 2021 18:24:16 +0200 Subject: [PATCH] backends: Remove TestSaveFilenames test Filenames are expected to match the sha256 sum of the file content. This rule is now enforced by the rest server thus making this test useless. --- internal/backend/test/tests.go | 43 ---------------------------------- 1 file changed, 43 deletions(-) diff --git a/internal/backend/test/tests.go b/internal/backend/test/tests.go index 8e1f78ca6..bc89f737d 100644 --- a/internal/backend/test/tests.go +++ b/internal/backend/test/tests.go @@ -657,49 +657,6 @@ func (s *Suite) TestSaveWrongHash(t *testing.T) { } } -var filenameTests = []struct { - name string - data string -}{ - {"1dfc6bc0f06cb255889e9ea7860a5753e8eb9665c9a96627971171b444e3113e", "x"}, - {"f00b4r", "foobar"}, - { - "1dfc6bc0f06cb255889e9ea7860a5753e8eb9665c9a96627971171b444e3113e4bf8f2d9144cc5420a80f04a4880ad6155fc58903a4fb6457c476c43541dcaa6-5", - "foobar content of data blob", - }, -} - -// TestSaveFilenames tests saving data with various file names in the backend. -func (s *Suite) TestSaveFilenames(t *testing.T) { - b := s.open(t) - defer s.close(t, b) - - for i, test := range filenameTests { - h := restic.Handle{Name: test.name, Type: restic.PackFile} - err := b.Save(context.TODO(), h, restic.NewByteReader([]byte(test.data), b.Hasher())) - if err != nil { - t.Errorf("test %d failed: Save() returned %+v", i, err) - continue - } - - buf, err := backend.LoadAll(context.TODO(), nil, b, h) - if err != nil { - t.Errorf("test %d failed: Load() returned %+v", i, err) - continue - } - - if !bytes.Equal(buf, []byte(test.data)) { - t.Errorf("test %d: returned wrong bytes", i) - } - - err = b.Remove(context.TODO(), h) - if err != nil { - t.Errorf("test %d failed: Remove() returned %+v", i, err) - continue - } - } -} - var testStrings = []struct { id string data string