From 6160d85d4f883f606a680f6bd03c63200c6d5bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Marku=C5=A1i=C4=87?= Date: Wed, 3 Aug 2022 14:06:12 +0200 Subject: [PATCH] Use tmpdir for tests --- pkg/commands/oscommands/os_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/commands/oscommands/os_test.go b/pkg/commands/oscommands/os_test.go index 389fdfc8e..abbdc9068 100644 --- a/pkg/commands/oscommands/os_test.go +++ b/pkg/commands/oscommands/os_test.go @@ -3,6 +3,7 @@ package oscommands import ( "io/ioutil" "os" + "path/filepath" "testing" "github.com/stretchr/testify/assert" @@ -145,7 +146,7 @@ func TestOSCommandAppendLineToFile(t *testing.T) { scenarios := []scenario{ { - "testFile", + filepath.Join(os.TempDir(), "testFile"), func(path string) { if err := ioutil.WriteFile(path, []byte("hello"), 0o600); err != nil { panic(err) @@ -153,7 +154,7 @@ func TestOSCommandAppendLineToFile(t *testing.T) { }, }, { - "testFileWithNewline", + filepath.Join(os.TempDir(), "testFileWithNewline"), func(path string) { if err := ioutil.WriteFile(path, []byte("hello\n"), 0o600); err != nil { panic(err)