From f821461599491931ee4e0f87bc5f406b9136fff7 Mon Sep 17 00:00:00 2001 From: Manar Elhabbal Date: Thu, 7 May 2026 03:28:54 +0300 Subject: [PATCH] refactor context_test file Signed-off-by: Manar Elhabbal --- cmd/context_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/context_test.go b/cmd/context_test.go index 8de7935a..ec233235 100644 --- a/cmd/context_test.go +++ b/cmd/context_test.go @@ -3,7 +3,7 @@ package cmd import ( "os" "testing" - + "path/filepath" "github.com/microcks/microcks-cli/pkg/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -36,9 +36,11 @@ users: auth-token: "" refresh-token: ""` -const testConfigFilePath = "./testdata/local.config" func TestDeleteContext(t *testing.T) { + // create a temporary directory for the config file + tmpDir := t.TempDir() + testConfigFilePath := filepath.Join(tmpDir, "local.config") //write the test config file err := os.WriteFile(testConfigFilePath, []byte(testConfig), os.ModePerm) require.NoError(t, err)