From fcb9c0bb8bed51ffb856b8e47f4e047ddd75eb67 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Thu, 24 Nov 2022 08:35:46 +0000 Subject: [chore] cleanup storage implementation, no need for multiple interface types (#1131) Signed-off-by: kim Signed-off-by: kim --- internal/media/manager_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'internal/media/manager_test.go') diff --git a/internal/media/manager_test.go b/internal/media/manager_test.go index 3955c1b63..659740af6 100644 --- a/internal/media/manager_test.go +++ b/internal/media/manager_test.go @@ -927,14 +927,19 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithDiskStorage() { temp := fmt.Sprintf("%s/gotosocial-test", os.TempDir()) defer os.RemoveAll(temp) - diskStorage, err := kv.OpenDisk(temp, &storage.DiskConfig{ + disk, err := storage.OpenDisk(temp, &storage.DiskConfig{ LockFile: path.Join(temp, "store.lock"), }) if err != nil { panic(err) } - diskManager, err := media.NewManager(suite.db, >sstorage.Local{KVStore: diskStorage}) + storage := >sstorage.Driver{ + KVStore: kv.New(disk), + Storage: disk, + } + + diskManager, err := media.NewManager(suite.db, storage) if err != nil { panic(err) } @@ -974,7 +979,7 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithDiskStorage() { suite.NotNil(dbAttachment) // make sure the processed file is in storage - processedFullBytes, err := diskStorage.Get(ctx, attachment.File.Path) + processedFullBytes, err := storage.Get(ctx, attachment.File.Path) suite.NoError(err) suite.NotEmpty(processedFullBytes) @@ -987,7 +992,7 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithDiskStorage() { suite.Equal(processedFullBytesExpected, processedFullBytes) // now do the same for the thumbnail and make sure it's what we expected - processedThumbnailBytes, err := diskStorage.Get(ctx, attachment.Thumbnail.Path) + processedThumbnailBytes, err := storage.Get(ctx, attachment.Thumbnail.Path) suite.NoError(err) suite.NotEmpty(processedThumbnailBytes) -- cgit v1.2.3