Skip to content

Commit 7051d8f

Browse files
Copilotillume
andcommitted
Add tests for API server endpoint configuration
- Added test for --api-server-endpoint flag - Added test for HEADLAMP_CONFIG_API_SERVER_ENDPOINT env var - Verified Helm template renders correctly with apiServerEndpoint value Co-authored-by: illume <9541+illume@users.noreply.github.com>
1 parent 01db26c commit 7051d8f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

backend/pkg/config/config_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ func TestParseBasic(t *testing.T) {
5555
assert.Equal(t, config.DefaultMeUsernamePath, conf.MeUsernamePath)
5656
},
5757
},
58+
{
59+
name: "api_server_endpoint_flag",
60+
args: []string{"go run ./cmd", "--api-server-endpoint=https://kube-proxy.example.com"},
61+
verify: func(t *testing.T, conf *config.Config) {
62+
assert.Equal(t, "https://kube-proxy.example.com", conf.APIServerEndpoint)
63+
},
64+
},
5865
}
5966

6067
for _, tt := range tests {
@@ -141,6 +148,16 @@ var ParseWithEnvTests = []struct {
141148
assert.Equal(t, "warn", conf.LogLevel)
142149
},
143150
},
151+
{
152+
name: "api_server_endpoint_from_env",
153+
args: []string{"go run ./cmd"},
154+
env: map[string]string{
155+
"HEADLAMP_CONFIG_API_SERVER_ENDPOINT": "https://kube-oidc-proxy.example.com:443",
156+
},
157+
verify: func(t *testing.T, conf *config.Config) {
158+
assert.Equal(t, "https://kube-oidc-proxy.example.com:443", conf.APIServerEndpoint)
159+
},
160+
},
144161
}
145162

146163
func TestParseWithEnv(t *testing.T) {

0 commit comments

Comments
 (0)