-
Notifications
You must be signed in to change notification settings - Fork 1
/
file_test.go
30 lines (26 loc) · 992 Bytes
/
file_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package fsEngine
import (
"os"
"testing"
"github.com/fanap-infra/fsEngine/internal/constants"
"github.com/fanap-infra/fsEngine/pkg/utils"
"github.com/fanap-infra/log"
"github.com/stretchr/testify/assert"
)
func TestFSEngine_GetFilePath(t *testing.T) {
homePath, err := os.UserHomeDir()
assert.Equal(t, nil, err)
_ = utils.DeleteFile(homePath + "/" + constants.FsPath)
_ = utils.DeleteFile(homePath + "/" + constants.HeaderPath)
_ = utils.DeleteFile(homePath + "/" + constants.HeaderBackUpPath)
eventListener := EventsListener{t: t}
fs, err := CreateFileSystem(fsID, homePath, fileSizeTest, blockSizeTest,
&eventListener, log.GetScope("test"), nil)
assert.Equal(t, nil, err)
assert.Equal(t, homePath+"/"+constants.FsPath, fs.GetFilePath())
err = fs.Close()
assert.Equal(t, nil, err)
_ = utils.DeleteFile(homePath + "/" + constants.FsPath)
_ = utils.DeleteFile(homePath + "/" + constants.HeaderPath)
_ = utils.DeleteFile(homePath + "/" + constants.HeaderBackUpPath)
}