Enable skipping of LDAP int tests when a firewall will block them
This commit is contained in:
parent
854903c4ed
commit
b8205006ca
@ -13,3 +13,6 @@ capabilities:
|
|||||||
# Does the cluster allow requests without authentication?
|
# Does the cluster allow requests without authentication?
|
||||||
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
||||||
anonymousAuthenticationSupported: false
|
anonymousAuthenticationSupported: false
|
||||||
|
|
||||||
|
# Are LDAP ports on the Internet reachable without interference from network firewalls or proxies?
|
||||||
|
canReachInternetLDAPPorts: true
|
||||||
|
@ -13,3 +13,6 @@ capabilities:
|
|||||||
# Does the cluster allow requests without authentication?
|
# Does the cluster allow requests without authentication?
|
||||||
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
||||||
anonymousAuthenticationSupported: true
|
anonymousAuthenticationSupported: true
|
||||||
|
|
||||||
|
# Are LDAP ports on the Internet reachable without interference from network firewalls or proxies?
|
||||||
|
canReachInternetLDAPPorts: true
|
||||||
|
@ -13,3 +13,6 @@ capabilities:
|
|||||||
# Does the cluster allow requests without authentication?
|
# Does the cluster allow requests without authentication?
|
||||||
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
||||||
anonymousAuthenticationSupported: true
|
anonymousAuthenticationSupported: true
|
||||||
|
|
||||||
|
# Are LDAP ports on the Internet reachable without interference from network firewalls or proxies?
|
||||||
|
canReachInternetLDAPPorts: true
|
||||||
|
@ -13,3 +13,6 @@ capabilities:
|
|||||||
# Does the cluster allow requests without authentication?
|
# Does the cluster allow requests without authentication?
|
||||||
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
||||||
anonymousAuthenticationSupported: true
|
anonymousAuthenticationSupported: true
|
||||||
|
|
||||||
|
# Are LDAP ports on the Internet reachable without interference from network firewalls or proxies?
|
||||||
|
canReachInternetLDAPPorts: true
|
||||||
|
@ -13,3 +13,6 @@ capabilities:
|
|||||||
# Does the cluster allow requests without authentication?
|
# Does the cluster allow requests without authentication?
|
||||||
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
# https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests
|
||||||
anonymousAuthenticationSupported: true
|
anonymousAuthenticationSupported: true
|
||||||
|
|
||||||
|
# Are LDAP ports on the Internet reachable without interference from network firewalls or proxies?
|
||||||
|
canReachInternetLDAPPorts: false
|
||||||
|
@ -277,6 +277,10 @@ func TestE2EFullIntegration(t *testing.T) {
|
|||||||
|
|
||||||
// Add an LDAP upstream IDP and try using it to authenticate during kubectl commands.
|
// Add an LDAP upstream IDP and try using it to authenticate during kubectl commands.
|
||||||
t.Run("with Supervisor LDAP upstream IDP", func(t *testing.T) {
|
t.Run("with Supervisor LDAP upstream IDP", func(t *testing.T) {
|
||||||
|
if len(env.ToolsNamespace) == 0 && !env.HasCapability(library.CanReachInternetLDAPPorts) {
|
||||||
|
t.Skip("LDAP integration test requires connectivity to an LDAP server")
|
||||||
|
}
|
||||||
|
|
||||||
expectedUsername := env.SupervisorUpstreamLDAP.TestUserMailAttributeValue
|
expectedUsername := env.SupervisorUpstreamLDAP.TestUserMailAttributeValue
|
||||||
expectedGroups := env.SupervisorUpstreamLDAP.TestUserDirectGroupsDNs
|
expectedGroups := env.SupervisorUpstreamLDAP.TestUserDirectGroupsDNs
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ func TestSupervisorLogin(t *testing.T) {
|
|||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
maybeSkip func(t *testing.T)
|
||||||
createIDP func(t *testing.T)
|
createIDP func(t *testing.T)
|
||||||
requestAuthorization func(t *testing.T, downstreamAuthorizeURL, downstreamCallbackURL string, httpClient *http.Client)
|
requestAuthorization func(t *testing.T, downstreamAuthorizeURL, downstreamCallbackURL string, httpClient *http.Client)
|
||||||
wantDownstreamIDTokenSubjectToMatch string
|
wantDownstreamIDTokenSubjectToMatch string
|
||||||
@ -95,6 +96,12 @@ func TestSupervisorLogin(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ldap with email as username and groups names as DNs and using an LDAP provider which supports TLS",
|
name: "ldap with email as username and groups names as DNs and using an LDAP provider which supports TLS",
|
||||||
|
maybeSkip: func(t *testing.T) {
|
||||||
|
t.Helper()
|
||||||
|
if len(env.ToolsNamespace) == 0 && !env.HasCapability(library.CanReachInternetLDAPPorts) {
|
||||||
|
t.Skip("LDAP integration test requires connectivity to an LDAP server")
|
||||||
|
}
|
||||||
|
},
|
||||||
createIDP: func(t *testing.T) {
|
createIDP: func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
secret := library.CreateTestSecret(t, env.SupervisorNamespace, "ldap-service-account", v1.SecretTypeBasicAuth,
|
secret := library.CreateTestSecret(t, env.SupervisorNamespace, "ldap-service-account", v1.SecretTypeBasicAuth,
|
||||||
@ -154,6 +161,12 @@ func TestSupervisorLogin(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ldap with CN as username and group names as CNs and using an LDAP provider which only supports StartTLS", // try another variation of configuration options
|
name: "ldap with CN as username and group names as CNs and using an LDAP provider which only supports StartTLS", // try another variation of configuration options
|
||||||
|
maybeSkip: func(t *testing.T) {
|
||||||
|
t.Helper()
|
||||||
|
if len(env.ToolsNamespace) == 0 && !env.HasCapability(library.CanReachInternetLDAPPorts) {
|
||||||
|
t.Skip("LDAP integration test requires connectivity to an LDAP server")
|
||||||
|
}
|
||||||
|
},
|
||||||
createIDP: func(t *testing.T) {
|
createIDP: func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
secret := library.CreateTestSecret(t, env.SupervisorNamespace, "ldap-service-account", v1.SecretTypeBasicAuth,
|
secret := library.CreateTestSecret(t, env.SupervisorNamespace, "ldap-service-account", v1.SecretTypeBasicAuth,
|
||||||
@ -213,14 +226,16 @@ func TestSupervisorLogin(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
tt := test
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
tt.maybeSkip(t)
|
||||||
|
|
||||||
testSupervisorLogin(t,
|
testSupervisorLogin(t,
|
||||||
test.createIDP,
|
tt.createIDP,
|
||||||
test.requestAuthorization,
|
tt.requestAuthorization,
|
||||||
test.wantDownstreamIDTokenSubjectToMatch,
|
tt.wantDownstreamIDTokenSubjectToMatch,
|
||||||
test.wantDownstreamIDTokenUsernameToMatch,
|
tt.wantDownstreamIDTokenUsernameToMatch,
|
||||||
test.wantDownstreamIDTokenGroups,
|
tt.wantDownstreamIDTokenGroups,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ const (
|
|||||||
ClusterSigningKeyIsAvailable Capability = "clusterSigningKeyIsAvailable"
|
ClusterSigningKeyIsAvailable Capability = "clusterSigningKeyIsAvailable"
|
||||||
AnonymousAuthenticationSupported Capability = "anonymousAuthenticationSupported"
|
AnonymousAuthenticationSupported Capability = "anonymousAuthenticationSupported"
|
||||||
HasExternalLoadBalancerProvider Capability = "hasExternalLoadBalancerProvider"
|
HasExternalLoadBalancerProvider Capability = "hasExternalLoadBalancerProvider"
|
||||||
|
CanReachInternetLDAPPorts Capability = "canReachInternetLDAPPorts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestEnv captures all the external parameters consumed by our integration tests.
|
// TestEnv captures all the external parameters consumed by our integration tests.
|
||||||
|
Loading…
Reference in New Issue
Block a user