Merge pull request #2009 from flant/skip-ldap-tests
fix: do not run LDAP tests locally by default
This commit is contained in:
commit
3c5a631ce3
1 changed files with 9 additions and 4 deletions
|
@ -526,6 +526,11 @@ func getenv(key, defaultVal string) string {
|
|||
// The tests require LDAP to be runnning.
|
||||
// You can use the provided docker-compose file to setup an LDAP server.
|
||||
func runTests(t *testing.T, connMethod connectionMethod, config *Config, tests []subtest) {
|
||||
ldapHost := os.Getenv("DEX_LDAP_HOST")
|
||||
if ldapHost == "" {
|
||||
t.Skipf(`test environment variable "DEX_LDAP_HOST" not set, skipping`)
|
||||
}
|
||||
|
||||
// Shallow copy.
|
||||
c := *config
|
||||
|
||||
|
@ -533,17 +538,17 @@ func runTests(t *testing.T, connMethod connectionMethod, config *Config, tests [
|
|||
// group search configuration.
|
||||
switch connMethod {
|
||||
case connectStartTLS:
|
||||
c.Host = fmt.Sprintf("%s:%s", getenv("DEX_LDAP_HOST", "localhost"), getenv("DEX_LDAP_PORT", "389"))
|
||||
c.Host = fmt.Sprintf("%s:%s", ldapHost, getenv("DEX_LDAP_PORT", "389"))
|
||||
c.RootCA = "testdata/certs/ca.crt"
|
||||
c.StartTLS = true
|
||||
case connectLDAPS:
|
||||
c.Host = fmt.Sprintf("%s:%s", getenv("DEX_LDAP_HOST", "localhost"), getenv("DEX_LDAP_TLS_PORT", "636"))
|
||||
c.Host = fmt.Sprintf("%s:%s", ldapHost, getenv("DEX_LDAP_TLS_PORT", "636"))
|
||||
c.RootCA = "testdata/certs/ca.crt"
|
||||
case connectInsecureSkipVerify:
|
||||
c.Host = fmt.Sprintf("%s:%s", getenv("DEX_LDAP_HOST", "localhost"), getenv("DEX_LDAP_TLS_PORT", "636"))
|
||||
c.Host = fmt.Sprintf("%s:%s", ldapHost, getenv("DEX_LDAP_TLS_PORT", "636"))
|
||||
c.InsecureSkipVerify = true
|
||||
case connectLDAP:
|
||||
c.Host = fmt.Sprintf("%s:%s", getenv("DEX_LDAP_HOST", "localhost"), getenv("DEX_LDAP_PORT", "389"))
|
||||
c.Host = fmt.Sprintf("%s:%s", ldapHost, getenv("DEX_LDAP_PORT", "389"))
|
||||
c.InsecureNoSSL = true
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue