Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk/ldap: update interface to use DialURL #20200

Merged
merged 4 commits into from
Apr 17, 2023
Merged

sdk/ldap: update interface to use DialURL #20200

merged 4 commits into from
Apr 17, 2023

Conversation

jasonodonnell
Copy link
Contributor

I recently merged #20144 which adds connection timeout configuration, however, this was causing race tests to fail since it was changing a package variable. To fix this, I've changed the LDAP interface to use the suggested ldap.DialURL function instead of the deprecated ldap.Dial and ldap.DialTLS functions.

@@ -16,16 +14,11 @@ func NewLDAP() LDAP {
// LDAP provides ldap functionality, but through an interface
// rather than statically. This allows faking it for tests.
type LDAP interface {
Dial(network, addr string) (Connection, error)
DialTLS(network, addr string, config *tls.Config) (Connection, error)
Dial(addr string, opts ...ldap.DialOpt) (Connection, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this change will have consequences for both vault-plugin-secrets-openldap and vault-plugin-secrets-ad. I think that is ok though? From what I can see these are only used in tests and it should be easy enough to update the tests if/when we update the sdk/ldaputil dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will, the mocks need updating.

Copy link
Contributor

@raymonstah raymonstah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly had concerns about the missing URL scheme.
Also, do any tests need to be updated?

sdk/helper/ldaputil/client.go Outdated Show resolved Hide resolved
sdk/helper/ldaputil/ldap.go Outdated Show resolved Hide resolved
@jasonodonnell
Copy link
Contributor Author

jasonodonnell commented Apr 17, 2023

Mostly had concerns about the missing URL scheme. Also, do any tests need to be updated?

The tests use the client DialLDAP method, so they shouldn't need updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants