Skip to content

Commit 9d11a6d

Browse files
committed
integration tests: allow running in a network sandbox
The testscript framework needs environment variables explicitly passed through to the test environment. This adds passthrough for proxy variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY and lowercase variants) that may be set by the sandbox or CI environment. Without these, integration tests running behind a proxy would fail with network DNS resolution failures when attempting to download resources. Assisted-by: Claude Code
1 parent f72df65 commit 9d11a6d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.claude/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"WebFetch(domain:rhcos.mirror.openshift.com)",
5+
"WebFetch(domain:mirror.openshift.com)",
6+
"WebFetch(domain:registry.ci.openshift.org)"
7+
],
8+
"deny": [],
9+
"ask": []
10+
}
11+
}

cmd/openshift-install/internal_integration_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@ func runIntegrationTest(t *testing.T, testFolder string) {
112112
}
113113
}
114114
e.Vars = append(e.Vars, fmt.Sprintf("RELEASE_IMAGE=%s", pullspec))
115-
if xdgCacheHome, ok := os.LookupEnv("XDG_CACHE_HOME"); ok && xdgCacheHome != "" {
116-
e.Vars = append(e.Vars, fmt.Sprintf("XDG_CACHE_HOME=%s", xdgCacheHome))
115+
// Pass through environment variables that may be set by the sandbox or CI
116+
passthroughVars := []string{"XDG_CACHE_HOME", "HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", "http_proxy", "https_proxy", "no_proxy"}
117+
for _, varName := range passthroughVars {
118+
if value, ok := os.LookupEnv(varName); ok && value != "" {
119+
e.Vars = append(e.Vars, fmt.Sprintf("%s=%s", varName, value))
120+
}
117121
}
118122
// When AUTH_FILE is set in the CI integration-tests job
119123
if authFilePath, ok := os.LookupEnv("AUTH_FILE"); ok && authFilePath != "" {

0 commit comments

Comments
 (0)