PLT-8314: Test Message Export Against S3 Bucket (#7957)

* Removed export directory config setting, in favour of hard-coding it to an 'export' directory under the local file directory. Improved the local file backend copy implementation to implicitly create the destination directory if it's missing

* Fixed the tests
Этот коммит содержится в:
Jonathan
2017-12-07 15:56:14 -05:00
коммит произвёл GitHub
родитель 98620d5aa3
Коммит ef597f6fe4
4 изменённых файлов: 30 добавлений и 52 удалений

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

@@ -51,9 +51,9 @@ func TestS3FileBackendTestSuite(t *testing.T) {
suite.Run(t, &FileBackendTestSuite{
settings: model.FileSettings{
DriverName: model.NewString(model.IMAGE_DRIVER_S3),
AmazonS3AccessKeyId: "minioaccesskey",
AmazonS3SecretAccessKey: "miniosecretkey",
AmazonS3Bucket: "mattermost-test",
AmazonS3AccessKeyId: model.MINIO_ACCESS_KEY,
AmazonS3SecretAccessKey: model.MINIO_SECRET_KEY,
AmazonS3Bucket: model.MINIO_BUCKET,
AmazonS3Endpoint: s3Endpoint,
AmazonS3SSL: model.NewBool(false),
},
@@ -106,6 +106,26 @@ func (s *FileBackendTestSuite) TestCopyFile() {
s.Nil(err)
}
func (s *FileBackendTestSuite) TestCopyFileToDirectoryThatDoesntExist() {
b := []byte("test")
path1 := "tests/" + model.NewId()
path2 := "tests/newdirectory/" + model.NewId()
err := s.backend.WriteFile(b, path1)
s.Nil(err)
defer s.backend.RemoveFile(path1)
err = s.backend.CopyFile(path1, path2)
s.Nil(err)
defer s.backend.RemoveFile(path2)
_, err = s.backend.ReadFile(path1)
s.Nil(err)
_, err = s.backend.ReadFile(path2)
s.Nil(err)
}
func (s *FileBackendTestSuite) TestMoveFile() {
b := []byte("test")
path1 := "tests/" + model.NewId()