From 2cc0ae6facec10f199c01009bf6fd7b47fcad86e Mon Sep 17 00:00:00 2001 From: Eric Chiang Date: Fri, 12 Feb 2016 15:11:14 -0800 Subject: [PATCH] functional: remove in memory connector configs from ldap tests --- .travis.yml | 1 + functional/ldap_test.go | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28f5419d..3ee23bb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/functional/ldap_test.go b/functional/ldap_test.go index e4a46987..4a42a1dd 100644 --- a/functional/ldap_test.go +++ b/functional/ldap_test.go @@ -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)