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

CLOUDP-72727: Fix LDAPConfigurationsService.Save to pass LDAPConfiguration as input #136

Merged
merged 4 commits into from Sep 11, 2020

Conversation

andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Sep 11, 2020

Description

I discovered bugs in the implementation of the LDAP configuration api call #135 (review) 346af62:

  1. LDAPConfigurationsService.Save was using the struct LDAP instead of LDAPConfiguration
  2. The path of the LDAPConfigurationsService.Delete was not correct

Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Required Checklist:

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code

Further comments

@colm-quinn
Copy link
Collaborator

Description

I discovered a bug in the implementation of the LDAP configuration api call that I have implemented [#135 (review)]

It's always good to describe the bug and fix in the description - it will help in the future if we look at this PR.

colm-quinn
colm-quinn previously approved these changes Sep 11, 2020
Copy link
Collaborator

@colm-quinn colm-quinn left a comment

Choose a reason for hiding this comment

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

LGTM, so easy to make those sort of mistakes :)

[q] Would the e2e tests catch an issue like this? It seems really easy to do and wondering how we can prevent in the future.

@@ -133,7 +133,7 @@ func TestLDAPConfigurations_Save(t *testing.T) {
}`)
})

request := &LDAP{}
request := &LDAPConfiguration{}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, I know. I am not sure how to prevent this issue though 😕 maybe we can populate the struct that we pass to function as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, maybe in the test for the call, then at least you purposefully expect certain values to be present in the input. Not blocking this PR, but something to consider.

@andreaangiolillo
Copy link
Collaborator Author

@colm-quinn ready for review

Comment on lines +141 to +149
request := &LDAPConfiguration{
LDAP: &LDAP{
AuthenticationEnabled: true,
AuthorizationEnabled: true,
Hostname: "atlas-ldaps-01.ldap.myteam.com",
Port: 636,
BindUsername: "CN=Administrator,CN=Users,DC=atlas-ldaps-01,DC=myteam,DC=com",
BindPassword: "admin",
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

Copy link
Collaborator

@colm-quinn colm-quinn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the changes

@andreaangiolillo
Copy link
Collaborator Author

@themantissa we'll merge this to not block the implementation of mongocli but feel free to tag DoU for a post merge review if you folks will use this for terraform

@andreaangiolillo andreaangiolillo merged commit a4f9004 into master Sep 11, 2020
@themantissa
Copy link
Collaborator

Left a note in Jira for when DoU starts LDAP work INTMDB-13

@gssbzn gssbzn deleted the CLOUDP-72727 branch September 15, 2020 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants