From 0a044a20a034abdf1447502b6b6a03b484c8b760 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Tue, 22 Aug 2023 15:07:59 +0800 Subject: [PATCH] fix windows test error Signed-off-by: Billy Zha --- internal/credential/store_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/credential/store_test.go b/internal/credential/store_test.go index c7f94569b..3a873ab14 100644 --- a/internal/credential/store_test.go +++ b/internal/credential/store_test.go @@ -26,10 +26,12 @@ import ( func TestNewStoreError(t *testing.T) { tmpDir := t.TempDir() filename := path.Join(tmpDir, "testfile.txt") - _, err := os.Create(filename) + file, err := os.Create(filename) if err != nil { t.Errorf("error: cannot create file : %v", err) } + defer file.Close() + err = os.Chmod(filename, 000) if err != nil { t.Errorf("error: cannot change file permissions: %v", err)