From 401d464c58bf52ff17bed5034ea35f1140255cee Mon Sep 17 00:00:00 2001 From: Roman Zipp Date: Mon, 17 Jan 2022 19:08:23 +0100 Subject: [PATCH] Update storage provider StoreExisting method to take absolute file paths --- storage/storage.go | 2 +- storage/storage_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/storage.go b/storage/storage.go index f4d6425..f7c7b8a 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -34,7 +34,7 @@ func (sp FileSystemStorageProvider) StoreRaw(bucketName string, objectName strin } func (sp FileSystemStorageProvider) StoreExisting(bucketName string, objectName string, existingFilePath string) (string, error) { - bytesRead, err := afero.ReadFile(sp.fileSystem, existingFilePath) + bytesRead, err := os.ReadFile(existingFilePath) if err != nil { return "", err } diff --git a/storage/storage_test.go b/storage/storage_test.go index 278e252..9e177fb 100644 --- a/storage/storage_test.go +++ b/storage/storage_test.go @@ -33,7 +33,8 @@ func TestFileSystemStorageProvider(t *testing.T) { t.Run("storeExisting method stores files in filesystem", func(t *testing.T) { fileSystem := afero.NewMemMapFs() - afero.WriteFile(fileSystem, "/tmp/existing.bin", dummyData, os.ModePerm) + err := os.WriteFile("/tmp/existing.bin", dummyData, os.ModePerm) + assert.Nil(t, err) provider := FileSystemStorageProvider{ fileSystem: fileSystem,