test: fix test on windows

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2024-06-04 20:25:38 +02:00 committed by Márk Sági-Kazár
parent 796fe3d4a4
commit 92e330ea77

View file

@ -368,14 +368,14 @@ func TestGetConfigFile(t *testing.T) {
t.Run("using a finder", func(t *testing.T) {
fs := afero.NewMemMapFs()
err := fs.Mkdir("/etc/viper", 0o777)
err := fs.Mkdir(testutil.AbsFilePath(t, "/etc/viper"), 0o777)
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)
finder := locafero.Finder{
Paths: []string{"/etc/viper"},
Paths: []string{testutil.AbsFilePath(t, "/etc/viper")},
Names: locafero.NameWithExtensions("config", SupportedExts...),
Type: locafero.FileTypeFile,
}
@ -389,7 +389,7 @@ func TestGetConfigFile(t *testing.T) {
v.SetConfigName("not-config")
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)
})
}
@ -460,7 +460,7 @@ func TestReadInConfig(t *testing.T) {
file.Close()
finder := locafero.Finder{
Paths: []string{"/etc/viper"},
Paths: []string{testutil.AbsFilePath(t, "/etc/viper")},
Names: locafero.NameWithExtensions("config", SupportedExts...),
Type: locafero.FileTypeFile,
}