-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(NODE-3795): unexpected No auth provider for DEFAULT defined error #3092
fix(NODE-3795): unexpected No auth provider for DEFAULT defined error #3092
Conversation
@@ -334,5 +334,19 @@ describe('Connection String', function () { | |||
expect(options).property('credentials').to.equal(credentials); | |||
expect(options).to.have.nested.property('credentials.source', 'admin'); | |||
}); | |||
|
|||
it('should retain specified authSource with no provided credentials', async function () { | |||
makeStub('authSource=thisShouldBeAuthSource'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a similar test for a non-srv connection string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just added + added extra assertions on the DEFAULT
mechanism to clearly test the specified error scenario in the ticket
cc0fdd9
to
dbaf782
Compare
Dismissing review since Neal is taking over the implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small suggestion because I think the goal of the test, if I understand it, is to make sure that we don't fail in the wrong place, but there's nothing invalid about the setup - we only fail because there isn't a proper server, not because we specified an authSource, right?
Co-authored-by: Daria Pardue <daria.pardue@mongodb.com>
test/unit/connection_string.test.ts
Outdated
@@ -89,6 +94,39 @@ describe('Connection String', function () { | |||
expect(options.credentials.source).to.equal('$external'); | |||
}); | |||
|
|||
it('should retain user-specified authSource with no credentials for non-srv URI', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is failing on evg as it expects an empty username but the property does not exist.
…hub.com:mongodb/node-mongodb-native into NODE-3795/fix-no-authProvider-for-default-error
Description
Adding test case and fix for a specified authSource but no further credentials provided.
The spec states that authSource can be ignored when no other credentials are given, we have a check that is throwing in this specific scenario because we still have an empty credentials object making it down to the connection creation layer.
What is changing?
This PR removes the credentials from the options object in this specific scenario and tests for it.
Double check the following
npm run check:lint
script<type>(NODE-xxxx)<!>: <description>