Make test path a constant

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
Oleg Zhurakivskyy 2022-06-13 23:27:54 +03:00
parent 30436a061b
commit 8245e35eb8

View File

@ -23,8 +23,10 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
const testPath = "/tmp/path/for/testing"
func TestCreateTopLevelDirectoriesErrorsWithSamePathForRootAndState(t *testing.T) { func TestCreateTopLevelDirectoriesErrorsWithSamePathForRootAndState(t *testing.T) {
path := "/tmp/path/for/testing" path := testPath
err := CreateTopLevelDirectories(&srvconfig.Config{ err := CreateTopLevelDirectories(&srvconfig.Config{
Root: path, Root: path,
State: path, State: path,
@ -34,7 +36,7 @@ func TestCreateTopLevelDirectoriesErrorsWithSamePathForRootAndState(t *testing.T
func TestCreateTopLevelDirectoriesWithEmptyStatePath(t *testing.T) { func TestCreateTopLevelDirectoriesWithEmptyStatePath(t *testing.T) {
statePath := "" statePath := ""
rootPath := "/tmp/path/for/testing" rootPath := testPath
err := CreateTopLevelDirectories(&srvconfig.Config{ err := CreateTopLevelDirectories(&srvconfig.Config{
Root: rootPath, Root: rootPath,
State: statePath, State: statePath,
@ -43,7 +45,7 @@ func TestCreateTopLevelDirectoriesWithEmptyStatePath(t *testing.T) {
} }
func TestCreateTopLevelDirectoriesWithEmptyRootPath(t *testing.T) { func TestCreateTopLevelDirectoriesWithEmptyRootPath(t *testing.T) {
statePath := "/tmp/path/for/testing" statePath := testPath
rootPath := "" rootPath := ""
err := CreateTopLevelDirectories(&srvconfig.Config{ err := CreateTopLevelDirectories(&srvconfig.Config{
Root: rootPath, Root: rootPath,