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
@ -526,6 +526,11 @@ func getenv(key, defaultVal string) string {
|
|||||||
// The tests require LDAP to be runnning.
|
// The tests require LDAP to be runnning.
|
||||||
// You can use the provided docker-compose file to setup an LDAP server.
|
// You can use the provided docker-compose file to setup an LDAP server.
|
||||||
func runTests(t *testing.T, connMethod connectionMethod, config *Config, tests []subtest) {
|
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.
|
// Shallow copy.
|
||||||
c := *config
|
c := *config
|
||||||
|
|
||||||
@ -533,17 +538,17 @@ func runTests(t *testing.T, connMethod connectionMethod, config *Config, tests [
|
|||||||
// group search configuration.
|
// group search configuration.
|
||||||
switch connMethod {
|
switch connMethod {
|
||||||
case connectStartTLS:
|
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.RootCA = "testdata/certs/ca.crt"
|
||||||
c.StartTLS = true
|
c.StartTLS = true
|
||||||
case connectLDAPS:
|
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"
|
c.RootCA = "testdata/certs/ca.crt"
|
||||||
case connectInsecureSkipVerify:
|
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
|
c.InsecureSkipVerify = true
|
||||||
case connectLDAP:
|
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
|
c.InsecureNoSSL = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user