fix: tests

This commit is contained in:
Deluan 2020-01-26 18:07:06 -05:00
parent cc6eacd608
commit 4e3b13050b
2 changed files with 5 additions and 3 deletions

View File

@ -40,7 +40,7 @@ func newWithPath(path string, skipFlags ...bool) *multiconfig.DefaultLoader {
// Read default values defined via tag fields "default"
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") {
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") {
loaders = append(loaders, &multiconfig.YAMLLoader{Path: path})
}
} else {
println("Skipping config file not found: ", path)
}
e := &multiconfig.EnvironmentLoader{}

View File

@ -21,9 +21,9 @@ func Init(t *testing.T, skipOnShort bool) {
_, file, _, _ := runtime.Caller(0)
appPath, _ := filepath.Abs(filepath.Join(filepath.Dir(file), ".."))
confPath, _ := filepath.Abs(filepath.Join(appPath, "tests", "navidrome-test.toml"))
println("Loading test configuration file from " + confPath)
os.Chdir(appPath)
conf.LoadFromFile(confPath, true)
conf.LoadFromFile("tests/navidrome-test.toml", true)
noLog := os.Getenv("NOLOG")
if noLog != "" {