functional: remove in memory connector configs from ldap tests
This commit is contained in:
parent
1658e86b2a
commit
2cc0ae6fac
2 changed files with 22 additions and 4 deletions
|
@ -21,6 +21,7 @@ install:
|
|||
script:
|
||||
- docker run -d -p 127.0.0.1:15432:5432 quay.io/coreos/postgres
|
||||
- LDAPCONTAINER=`docker run -e LDAP_TLS_PROTOCOL_MIN=3.0 -e LDAP_TLS_CIPHER_SUITE=NORMAL -d -p 127.0.0.1:1389:389 -p 127.0.0.1:1636:636 -h tlstest.local osixia/openldap`
|
||||
- ./build
|
||||
- ./test
|
||||
- docker cp ${LDAPCONTAINER}:container/service/:cfssl/assets/default-ca/default-ca.pem /tmp/openldap-ca.pem
|
||||
- docker cp ${LDAPCONTAINER}:container/service/slapd/assets/certs/ldap.key /tmp/ldap.key
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/coreos/dex/connector"
|
||||
"github.com/coreos/dex/db"
|
||||
"github.com/coreos/dex/repo"
|
||||
"github.com/coreos/go-oidc/oidc"
|
||||
"gopkg.in/ldap.v2"
|
||||
|
@ -93,13 +94,17 @@ func TestConnectorLDAPConnectFail(t *testing.T) {
|
|||
|
||||
templates := template.New(connector.LDAPLoginPageTemplateName)
|
||||
|
||||
ccr := connector.NewConnectorConfigRepoFromConfigs(
|
||||
ccr := db.NewConnectorConfigRepo(db.NewMemDB())
|
||||
err := ccr.Set(
|
||||
[]connector.ConnectorConfig{&connector.LDAPConnectorConfig{
|
||||
ID: "ldap",
|
||||
ServerHost: ldapHost,
|
||||
ServerPort: ldapPort + 1,
|
||||
}},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cc, err := ccr.GetConnectorByID(tx, "ldap")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -121,13 +126,17 @@ func TestConnectorLDAPConnectSuccess(t *testing.T) {
|
|||
|
||||
templates := template.New(connector.LDAPLoginPageTemplateName)
|
||||
|
||||
ccr := connector.NewConnectorConfigRepoFromConfigs(
|
||||
ccr := db.NewConnectorConfigRepo(db.NewMemDB())
|
||||
err := ccr.Set(
|
||||
[]connector.ConnectorConfig{&connector.LDAPConnectorConfig{
|
||||
ID: "ldap",
|
||||
ServerHost: ldapHost,
|
||||
ServerPort: ldapPort,
|
||||
}},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cc, err := ccr.GetConnectorByID(tx, "ldap")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -149,7 +158,8 @@ func TestConnectorLDAPcaFilecertFileConnectTLS(t *testing.T) {
|
|||
|
||||
templates := template.New(connector.LDAPLoginPageTemplateName)
|
||||
|
||||
ccr := connector.NewConnectorConfigRepoFromConfigs(
|
||||
ccr := db.NewConnectorConfigRepo(db.NewMemDB())
|
||||
err := ccr.Set(
|
||||
[]connector.ConnectorConfig{&connector.LDAPConnectorConfig{
|
||||
ID: "ldap",
|
||||
ServerHost: ldapHost,
|
||||
|
@ -160,6 +170,9 @@ func TestConnectorLDAPcaFilecertFileConnectTLS(t *testing.T) {
|
|||
CaFile: "/tmp/openldap-ca.pem",
|
||||
}},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cc, err := ccr.GetConnectorByID(tx, "ldap")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -181,7 +194,8 @@ func TestConnectorLDAPcaFilecertFileConnectSSL(t *testing.T) {
|
|||
|
||||
templates := template.New(connector.LDAPLoginPageTemplateName)
|
||||
|
||||
ccr := connector.NewConnectorConfigRepoFromConfigs(
|
||||
ccr := db.NewConnectorConfigRepo(db.NewMemDB())
|
||||
err := ccr.Set(
|
||||
[]connector.ConnectorConfig{&connector.LDAPConnectorConfig{
|
||||
ID: "ldap",
|
||||
ServerHost: ldapHost,
|
||||
|
@ -192,6 +206,9 @@ func TestConnectorLDAPcaFilecertFileConnectSSL(t *testing.T) {
|
|||
CaFile: "/tmp/openldap-ca.pem",
|
||||
}},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cc, err := ccr.GetConnectorByID(tx, "ldap")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
Reference in a new issue