mirror of https://github.com/spf13/viper.git
test: fix test on windows
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
parent
796fe3d4a4
commit
92e330ea77
|
@ -368,14 +368,14 @@ func TestGetConfigFile(t *testing.T) {
|
||||||
t.Run("using a finder", func(t *testing.T) {
|
t.Run("using a finder", func(t *testing.T) {
|
||||||
fs := afero.NewMemMapFs()
|
fs := afero.NewMemMapFs()
|
||||||
|
|
||||||
err := fs.Mkdir("/etc/viper", 0o777)
|
err := fs.Mkdir(testutil.AbsFilePath(t, "/etc/viper"), 0o777)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
_, err = fs.Create("/etc/viper/config.yaml")
|
_, err = fs.Create(testutil.AbsFilePath(t, "/etc/viper/config.yaml"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
finder := locafero.Finder{
|
finder := locafero.Finder{
|
||||||
Paths: []string{"/etc/viper"},
|
Paths: []string{testutil.AbsFilePath(t, "/etc/viper")},
|
||||||
Names: locafero.NameWithExtensions("config", SupportedExts...),
|
Names: locafero.NameWithExtensions("config", SupportedExts...),
|
||||||
Type: locafero.FileTypeFile,
|
Type: locafero.FileTypeFile,
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ func TestGetConfigFile(t *testing.T) {
|
||||||
v.SetConfigName("not-config")
|
v.SetConfigName("not-config")
|
||||||
|
|
||||||
filename, err := v.getConfigFile()
|
filename, err := v.getConfigFile()
|
||||||
assert.Equal(t, "/etc/viper/config.yaml", filename)
|
assert.Equal(t, testutil.AbsFilePath(t, "/etc/viper/config.yaml"), testutil.AbsFilePath(t, filename))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ func TestReadInConfig(t *testing.T) {
|
||||||
file.Close()
|
file.Close()
|
||||||
|
|
||||||
finder := locafero.Finder{
|
finder := locafero.Finder{
|
||||||
Paths: []string{"/etc/viper"},
|
Paths: []string{testutil.AbsFilePath(t, "/etc/viper")},
|
||||||
Names: locafero.NameWithExtensions("config", SupportedExts...),
|
Names: locafero.NameWithExtensions("config", SupportedExts...),
|
||||||
Type: locafero.FileTypeFile,
|
Type: locafero.FileTypeFile,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue