Run TestSupervisorLogin only on valid HTTP/HTTPS supervisor addresses
We were assuming that env.SupervisorHTTPAddress was set, but it might not be depending on the environment on which the integration tests are being run. For example, in our acceptance environments, we don't currently set env.SupervisorHTTPAddress. I tried to follow the pattern from TestSupervisorOIDCDiscovery here. Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
parent
dfb6544171
commit
5b04192945
@ -32,10 +32,26 @@ func TestSupervisorLogin(t *testing.T) {
|
|||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
Scheme string
|
||||||
|
Address string
|
||||||
|
CABundle string
|
||||||
|
}{
|
||||||
|
{Scheme: "http", Address: env.SupervisorHTTPAddress},
|
||||||
|
{Scheme: "https", Address: env.SupervisorHTTPSIngressAddress, CABundle: env.SupervisorHTTPSIngressCABundle},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
scheme := test.Scheme
|
||||||
|
addr := test.Address
|
||||||
|
caBundle := test.CABundle
|
||||||
|
|
||||||
|
if addr == "" {
|
||||||
|
// Both cases are not required, so when one is empty skip it.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Create downstream OIDC provider (i.e., update supervisor with OIDC provider).
|
// Create downstream OIDC provider (i.e., update supervisor with OIDC provider).
|
||||||
scheme := "http"
|
|
||||||
addr := env.SupervisorHTTPAddress
|
|
||||||
caBundle := ""
|
|
||||||
path := "/some/path"
|
path := "/some/path"
|
||||||
issuer := fmt.Sprintf("https://%s%s", addr, path)
|
issuer := fmt.Sprintf("https://%s%s", addr, path)
|
||||||
_, _ = requireCreatingOIDCProviderCausesDiscoveryEndpointsToAppear(
|
_, _ = requireCreatingOIDCProviderCausesDiscoveryEndpointsToAppear(
|
||||||
@ -96,6 +112,7 @@ func TestSupervisorLogin(t *testing.T) {
|
|||||||
upstreamRedirectURI,
|
upstreamRedirectURI,
|
||||||
rsp.Header.Get("Location"),
|
rsp.Header.Get("Location"),
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeDownstreamAuthURL(t *testing.T, scheme, addr, path string) string {
|
func makeDownstreamAuthURL(t *testing.T, scheme, addr, path string) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user