From 47bde119597961113d769a9d46a565f448565e7a Mon Sep 17 00:00:00 2001 From: LarytheLord Date: Sun, 8 Mar 2026 18:32:35 +0530 Subject: [PATCH] test(cli): use t.Cleanup for resetEnv with t.Setenv Signed-off-by: LarytheLord --- pkg/cli/environment_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cli/environment_test.go b/pkg/cli/environment_test.go index df87b86df..2d7851a4f 100644 --- a/pkg/cli/environment_test.go +++ b/pkg/cli/environment_test.go @@ -120,7 +120,8 @@ func TestEnvSettings(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - defer resetEnv()() + cleanup := resetEnv() + t.Cleanup(cleanup) for k, v := range tt.envvars { t.Setenv(k, v) @@ -219,7 +220,8 @@ func TestEnvOrBool(t *testing.T) { } func TestUserAgentHeaderInK8sRESTClientConfig(t *testing.T) { - defer resetEnv()() + cleanup := resetEnv() + t.Cleanup(cleanup) kubeconfigPath := filepath.Join(t.TempDir(), "config") kubeconfig := `apiVersion: v1