From ce3dbde836abcee40e60d3135c84ae2188477f5b Mon Sep 17 00:00:00 2001 From: Ben Durrans Date: Thu, 30 Jul 2026 09:55:10 +0100 Subject: [PATCH] test(connectivity): isolate all checker env vars in TestDetectProxyConfig TestDetectProxyConfig cleared only the proxy variables (HTTPS_PROXY, NO_PROXY and friends) before each case. DetectProxyConfig also reads NODE_EXTRA_CA_CERTS, KRB5_CONFIG and KRB5CCNAME, so those leaked in from the host environment. Any developer with NODE_EXTRA_CA_CERTS set (a corporate TLS-inspection CA bundle, for example) fails six of the seven subtests with a diff between "" and their own certificate path. Unsetting the variable makes the same suite pass, which is a confusing way to find out the test was never isolated. Derive the cleared list from envVarSpecs, the same list the production code iterates, so variables added there are isolated automatically instead of silently reintroducing this. Co-authored-by: Cursor --- .../connectivity/checker_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/local_workflows/connectivity_check_extension/connectivity/checker_test.go b/pkg/local_workflows/connectivity_check_extension/connectivity/checker_test.go index ba6ffa531..ae305d9a9 100644 --- a/pkg/local_workflows/connectivity_check_extension/connectivity/checker_test.go +++ b/pkg/local_workflows/connectivity_check_extension/connectivity/checker_test.go @@ -149,10 +149,13 @@ func TestDetectProxyConfig(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - // Clear all proxy-related environment variables for test isolation - proxyEnvVars := []string{"HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "NO_PROXY", "no_proxy"} - for _, key := range proxyEnvVars { - t.Setenv(key, "") + // Clear every variable the checker reads, so the host environment + // cannot leak into the result. Derived from envVarSpecs so that + // variables added there stay isolated. + for _, spec := range envVarSpecs { + for _, key := range spec.names { + t.Setenv(key, "") + } } // Set test environment