MM-10188: expect io.Reader in FileBackend.WriteFile (#8765)

This is a reworked set of changes originally from @josephGuo to begin
reducing the duplicated memory required when uploading files.
Этот коммит содержится в:
Jesse Hallam
2018-05-10 18:16:33 -04:00
коммит произвёл Christopher Speller
родитель 7fa1c6c4ba
Коммит 2b27e12445
10 изменённых файлов: 95 добавлений и 51 удалений

Просмотреть файл

@@ -150,8 +150,10 @@ func TestSendMailUsingConfig(t *testing.T) {
filePath2 := fmt.Sprintf("test2/%s", fileName)
fileContents1 := []byte("hello world")
fileContents2 := []byte("foo bar")
assert.Nil(t, fileBackend.WriteFile(fileContents1, filePath1))
assert.Nil(t, fileBackend.WriteFile(fileContents2, filePath2))
_, err := fileBackend.WriteFile(bytes.NewReader(fileContents1), filePath1)
assert.Nil(t, err)
_, err := fileBackend.WriteFile(bytes.NewReader(fileContents2), filePath2)
assert.Nil(t, err)
defer fileBackend.RemoveFile(filePath1)
defer fileBackend.RemoveFile(filePath2)