mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-05-29 11:10:34 +00:00
Skip some recently added integration tests when LDAP is unavailable
Also refactor to use shared test helper for skipping LDAP and AD tests.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020 the Pinniped contributors. All Rights Reserved.
|
||||
// Copyright 2020-2022 the Pinniped contributors. All Rights Reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package testlib
|
||||
@@ -8,7 +8,28 @@ import "testing"
|
||||
// skipUnlessIntegration skips the current test if `-short` has been passed to `go test`.
|
||||
func skipUnlessIntegration(t *testing.T) {
|
||||
t.Helper()
|
||||
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test because of '-short' flag")
|
||||
}
|
||||
}
|
||||
|
||||
func SkipTestWhenLDAPIsUnavailable(t *testing.T, env *TestEnv) {
|
||||
t.Helper()
|
||||
|
||||
if len(env.ToolsNamespace) == 0 && !env.HasCapability(CanReachInternetLDAPPorts) {
|
||||
t.Skip("LDAP integration test requires connectivity to an LDAP server")
|
||||
}
|
||||
}
|
||||
|
||||
func SkipTestWhenActiveDirectoryIsUnavailable(t *testing.T, env *TestEnv) {
|
||||
t.Helper()
|
||||
|
||||
if !env.HasCapability(CanReachInternetLDAPPorts) {
|
||||
t.Skip("Active Directory integration test requires network connectivity to an AD server")
|
||||
}
|
||||
|
||||
if IntegrationEnv(t).SupervisorUpstreamActiveDirectory.Host == "" {
|
||||
t.Skip("Active Directory hostname not specified")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user