test: fix failing tests on windows

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2021-09-22 20:17:20 +02:00 committed by Márk Sági-Kazár
parent 14c9dc6a57
commit 0594522560

View file

@ -1808,8 +1808,6 @@ func TestWriteConfigDotEnv(t *testing.T) {
} }
func TestSafeWriteConfig(t *testing.T) { func TestSafeWriteConfig(t *testing.T) {
skipWindows(t)
v := New() v := New()
fs := afero.NewMemMapFs() fs := afero.NewMemMapFs()
v.SetFs(fs) v.SetFs(fs)
@ -1818,7 +1816,7 @@ func TestSafeWriteConfig(t *testing.T) {
v.SetConfigType("yaml") v.SetConfigType("yaml")
require.NoError(t, v.ReadConfig(bytes.NewBuffer(yamlExample))) require.NoError(t, v.ReadConfig(bytes.NewBuffer(yamlExample)))
require.NoError(t, v.SafeWriteConfig()) require.NoError(t, v.SafeWriteConfig())
read, err := afero.ReadFile(fs, "/test/c.yaml") read, err := afero.ReadFile(fs, testutil.AbsFilePath(t, "/test/c.yaml"))
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, yamlWriteExpected, read) assert.Equal(t, yamlWriteExpected, read)
} }
@ -1833,11 +1831,9 @@ func TestSafeWriteConfigWithMissingConfigPath(t *testing.T) {
} }
func TestSafeWriteConfigWithExistingFile(t *testing.T) { func TestSafeWriteConfigWithExistingFile(t *testing.T) {
skipWindows(t)
v := New() v := New()
fs := afero.NewMemMapFs() fs := afero.NewMemMapFs()
fs.Create("/test/c.yaml") fs.Create(testutil.AbsFilePath(t, "/test/c.yaml"))
v.SetFs(fs) v.SetFs(fs)
v.AddConfigPath("/test") v.AddConfigPath("/test")
v.SetConfigName("c") v.SetConfigName("c")
@ -1874,11 +1870,9 @@ func TestSafeWriteConfigAsWithExistingFile(t *testing.T) {
} }
func TestWriteHiddenFile(t *testing.T) { func TestWriteHiddenFile(t *testing.T) {
skipWindows(t)
v := New() v := New()
fs := afero.NewMemMapFs() fs := afero.NewMemMapFs()
fs.Create("/test/.config") fs.Create(testutil.AbsFilePath(t, "/test/.config"))
v.SetFs(fs) v.SetFs(fs)
v.SetConfigName(".config") v.SetConfigName(".config")