Skip to content

Commit 1d0797a

Browse files
committed
chore: comments
1 parent e812267 commit 1d0797a

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

test/integration/auth/mongodb_aws.test.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ describe('MONGODB-AWS', function () {
164164
});
165165

166166
context('when using a custom credential provider', function () {
167+
// NOTE: Logic for scenarios 1-6 is handled via the evergreen variant configs.
168+
// Scenarios 1-6 from the previous section with a user provided AWS_CREDENTIAL_PROVIDER auth mechanism
169+
// property. This credentials MAY be obtained from the default credential provider from the AWS SDK.
170+
// If the default provider does not cover all scenarios above, those not covered MAY be skipped.
171+
// In these tests the driver MUST also assert that the user provided credential provider was called
172+
// in each test. This may be via a custom function or object that wraps the calls to the custom provider
173+
// and asserts that it was called at least once. For test scenarios where the drivers tools scripts put
174+
// the credentials in the MONGODB_URI, drivers MAY extract the credentials from the URI and return the AWS
175+
// credentials directly from the custom provider instead of using the AWS SDK default provider.
167176
context('1. Custom Credential Provider Authenticates', function () {
168177
let providerCount = 0;
169178

@@ -201,12 +210,16 @@ describe('MONGODB-AWS', function () {
201210
});
202211

203212
context('2. Custom Credential Provider Authentication Precedence', function () {
213+
// Create a MongoClient configured with AWS auth and credentials in the URI.
214+
// Example: mongodb://<AccessKeyId>:<SecretAccessKey>@localhost:27017/?authMechanism=MONGODB-AWS
215+
// Configure a custom credential provider to pass valid AWS credentials. The provider must
216+
// track if it was called.
217+
// Expect authentication to succeed and the custom credential provider was not called.
204218
context('Case 1: Credentials in URI Take Precedence', function () {
205219
let providerCount = 0;
206220
let provider;
207221

208222
beforeEach(function () {
209-
console.log(client?.options);
210223
if (!client?.options.credentials.username) {
211224
this.skipReason = 'Test only runs when credentials are present in the URI';
212225
return this.skip();
@@ -219,7 +232,6 @@ describe('MONGODB-AWS', function () {
219232
});
220233

221234
it('authenticates with a user provided credentials provider', async function () {
222-
console.log(process.env);
223235
client = this.configuration.newClient(process.env.MONGODB_URI, {
224236
authMechanismProperties: {
225237
AWS_CREDENTIAL_PROVIDER: provider
@@ -238,6 +250,11 @@ describe('MONGODB-AWS', function () {
238250
});
239251
});
240252

253+
// Run this test in an environment with AWS credentials configured as environment variables
254+
// (e.g. AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN)
255+
// Create a MongoClient configured to use AWS auth. Example: mongodb://localhost:27017/?authMechanism=MONGODB-AWS.
256+
// Configure a custom credential provider to pass valid AWS credentials. The provider must track if it was called.
257+
// Expect authentication to succeed and the custom credential provider was called.
241258
context('Case 2: Custom Provider Takes Precedence Over Environment Variables', function () {
242259
let providerCount = 0;
243260
let provider;

0 commit comments

Comments
 (0)