summaryrefslogtreecommitdiffstats
path: root/utils/file_backend_test.go
diff options
context:
space:
mode:
authorJonathan <jonfritz@gmail.com>2017-12-07 15:56:14 -0500
committerGitHub <noreply@github.com>2017-12-07 15:56:14 -0500
commitef597f6fe45cae8b3ba405ff89f5b20bfbf349e5 (patch)
tree612629dd3ee1b3badf17ccd90cd4d37228044b24 /utils/file_backend_test.go
parent98620d5aa37b117b0e1d3bd3402d24f610bf8a3f (diff)
downloadchat-ef597f6fe45cae8b3ba405ff89f5b20bfbf349e5.tar.gz
chat-ef597f6fe45cae8b3ba405ff89f5b20bfbf349e5.tar.bz2
chat-ef597f6fe45cae8b3ba405ff89f5b20bfbf349e5.zip
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
Diffstat (limited to 'utils/file_backend_test.go')
-rw-r--r--utils/file_backend_test.go26
1 files changed, 23 insertions, 3 deletions
diff --git a/utils/file_backend_test.go b/utils/file_backend_test.go
index 098f86bbd..76cd1f4a8 100644
--- a/utils/file_backend_test.go
+++ b/utils/file_backend_test.go
@@ -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()