Skip to content

Commit 1e2a63a

Browse files
committed
test: check for sdk
1 parent 39e8251 commit 1e2a63a

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

test/integration/auth/mongodb_aws.test.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,32 @@ describe('MONGODB-AWS', function () {
6161
expect(result).to.be.a('number');
6262
});
6363

64-
it('authenticates with a user provided credentials provider', async function () {
65-
// @ts-expect-error We intentionally access a protected variable.
66-
const credentialProvider = AWSTemporaryCredentialProvider.awsSDK;
67-
client = this.configuration.newClient(process.env.MONGODB_URI, {
68-
authMechanismProperties: {
69-
AWS_CREDENTIAL_PROVIDER: credentialProvider.fromNodeProviderChain()
64+
context('when user supplies a credentials provider', function () {
65+
beforeEach(function () {
66+
if (!awsSdkPresent) {
67+
this.skipReason = 'only relevant to AssumeRoleWithWebIdentity with SDK installed';
68+
return this.skip();
7069
}
7170
});
7271

73-
const result = await client
74-
.db('aws')
75-
.collection('aws_test')
76-
.estimatedDocumentCount()
77-
.catch(error => error);
72+
it('authenticates with a user provided credentials provider', async function () {
73+
// @ts-expect-error We intentionally access a protected variable.
74+
const credentialProvider = AWSTemporaryCredentialProvider.awsSDK;
75+
client = this.configuration.newClient(process.env.MONGODB_URI, {
76+
authMechanismProperties: {
77+
AWS_CREDENTIAL_PROVIDER: credentialProvider.fromNodeProviderChain()
78+
}
79+
});
7880

79-
expect(result).to.not.be.instanceOf(MongoServerError);
80-
expect(result).to.be.a('number');
81+
const result = await client
82+
.db('aws')
83+
.collection('aws_test')
84+
.estimatedDocumentCount()
85+
.catch(error => error);
86+
87+
expect(result).to.not.be.instanceOf(MongoServerError);
88+
expect(result).to.be.a('number');
89+
});
8190
});
8291

8392
it('should allow empty string in authMechanismProperties.AWS_SESSION_TOKEN to override AWS_SESSION_TOKEN environment variable', function () {

0 commit comments

Comments
 (0)