Skip to content

Commit 5676f81

Browse files
fix(NODE-3986): unskip MONGODB-AWS test (#3397)
1 parent 0a2ad07 commit 5676f81

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/connection_string.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import { MongoCredentials } from './cmap/auth/mongo_credentials';
88
import { AUTH_MECHS_AUTH_SRC_EXTERNAL, AuthMechanism } from './cmap/auth/providers';
99
import { Compressor, CompressorName } from './cmap/wire_protocol/compression';
1010
import { Encrypter } from './encrypter';
11-
import { MongoAPIError, MongoInvalidArgumentError, MongoParseError } from './error';
11+
import {
12+
MongoAPIError,
13+
MongoInvalidArgumentError,
14+
MongoMissingCredentialsError,
15+
MongoParseError
16+
} from './error';
1217
import { Logger, LoggerLevel } from './logger';
1318
import {
1419
DriverInfo,
@@ -407,6 +412,12 @@ export function parseOptions(
407412
});
408413
}
409414

415+
if (isAws && mongoOptions.credentials.username && !mongoOptions.credentials.password) {
416+
throw new MongoMissingCredentialsError(
417+
`When using ${mongoOptions.credentials.mechanism} password must be set when a username is specified`
418+
);
419+
}
420+
410421
mongoOptions.credentials.validate();
411422

412423
// Check if the only auth related option provided was authSource, if so we can remove credentials

test/unit/assorted/auth.spec.test.ts

-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
import { loadSpecTests } from '../../spec';
22
import { executeUriValidationTest } from '../../tools/uri_spec_runner';
33

4-
const SKIP = ['should throw an exception if username and no password (MONGODB-AWS)'];
5-
64
describe('Auth option spec tests', function () {
75
const suites = loadSpecTests('auth');
86

97
for (const suite of suites) {
108
describe(suite.name, function () {
119
for (const test of suite.tests) {
1210
it(`${test.description}`, function () {
13-
if (SKIP.includes(test.description)) {
14-
this.test.skipReason = 'NODE-3986: Fix MONGODB-AWS Spec Test';
15-
this.skip();
16-
}
1711
executeUriValidationTest(test);
1812
});
1913
}

0 commit comments

Comments
 (0)