fix: tests
This commit is contained in:
@@ -40,7 +40,7 @@ func newWithPath(path string, skipFlags ...bool) *multiconfig.DefaultLoader {
|
|||||||
// Read default values defined via tag fields "default"
|
// Read default values defined via tag fields "default"
|
||||||
loaders = append(loaders, &multiconfig.TagLoader{})
|
loaders = append(loaders, &multiconfig.TagLoader{})
|
||||||
|
|
||||||
if _, err := os.Stat(consts.LocalConfigFile); err == nil {
|
if _, err := os.Stat(path); err == nil {
|
||||||
if strings.HasSuffix(path, "toml") {
|
if strings.HasSuffix(path, "toml") {
|
||||||
loaders = append(loaders, &multiconfig.TOMLLoader{Path: path})
|
loaders = append(loaders, &multiconfig.TOMLLoader{Path: path})
|
||||||
}
|
}
|
||||||
@@ -52,6 +52,8 @@ func newWithPath(path string, skipFlags ...bool) *multiconfig.DefaultLoader {
|
|||||||
if strings.HasSuffix(path, "yml") || strings.HasSuffix(path, "yaml") {
|
if strings.HasSuffix(path, "yml") || strings.HasSuffix(path, "yaml") {
|
||||||
loaders = append(loaders, &multiconfig.YAMLLoader{Path: path})
|
loaders = append(loaders, &multiconfig.YAMLLoader{Path: path})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
println("Skipping config file not found: ", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
e := &multiconfig.EnvironmentLoader{}
|
e := &multiconfig.EnvironmentLoader{}
|
||||||
|
|||||||
+2
-2
@@ -21,9 +21,9 @@ func Init(t *testing.T, skipOnShort bool) {
|
|||||||
_, file, _, _ := runtime.Caller(0)
|
_, file, _, _ := runtime.Caller(0)
|
||||||
appPath, _ := filepath.Abs(filepath.Join(filepath.Dir(file), ".."))
|
appPath, _ := filepath.Abs(filepath.Join(filepath.Dir(file), ".."))
|
||||||
confPath, _ := filepath.Abs(filepath.Join(appPath, "tests", "navidrome-test.toml"))
|
confPath, _ := filepath.Abs(filepath.Join(appPath, "tests", "navidrome-test.toml"))
|
||||||
|
println("Loading test configuration file from " + confPath)
|
||||||
os.Chdir(appPath)
|
os.Chdir(appPath)
|
||||||
conf.LoadFromFile(confPath, true)
|
conf.LoadFromFile("tests/navidrome-test.toml", true)
|
||||||
|
|
||||||
noLog := os.Getenv("NOLOG")
|
noLog := os.Getenv("NOLOG")
|
||||||
if noLog != "" {
|
if noLog != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user