diff options
author | George Goldberg <george@gberg.me> | 2017-09-25 15:22:28 +0100 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-09-25 10:22:28 -0400 |
commit | aade47dccd3431c1e3e17818766549aa93401344 (patch) | |
tree | 6a399167c39c7df9bbb823a0cd651ddf1c8418a1 /utils/file_test.go | |
parent | 49fe5fbf3db56fc466b8997b182ee135d7a4365d (diff) | |
download | chat-aade47dccd3431c1e3e17818766549aa93401344.tar.gz chat-aade47dccd3431c1e3e17818766549aa93401344.tar.bz2 chat-aade47dccd3431c1e3e17818766549aa93401344.zip |
PLT-7666: Clean up files on disk/s3 in data retention. (#7503)
Diffstat (limited to 'utils/file_test.go')
-rw-r--r-- | utils/file_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/file_test.go b/utils/file_test.go index c9a50472d..0ad02de7e 100644 --- a/utils/file_test.go +++ b/utils/file_test.go @@ -125,6 +125,32 @@ func (s *FileTestSuite) TestRemoveFile() { s.Nil(RemoveDirectory("tests2")) } +func (s *FileTestSuite) TestListDirectory() { + b := []byte("test") + path1 := "19700101/" + model.NewId() + path2 := "19800101/" + model.NewId() + + s.Nil(WriteFile(b, path1)) + defer RemoveFile(path1) + s.Nil(WriteFile(b, path2)) + defer RemoveFile(path2) + + paths, err := ListDirectory("") + s.Nil(err) + + found1 := false + found2 := false + for _, path := range *paths { + if path == "19700101" { + found1 = true + } else if path == "19800101" { + found2 = true + } + } + s.True(found1) + s.True(found2) +} + func (s *FileTestSuite) TestRemoveDirectory() { b := []byte("test") |