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

fix(NODE-3986): unskip MONGODB-AWS test #3397

Merged
merged 4 commits into from Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/connection_string.ts
Expand Up @@ -8,7 +8,12 @@ import { MongoCredentials } from './cmap/auth/mongo_credentials';
import { AUTH_MECHS_AUTH_SRC_EXTERNAL, AuthMechanism } from './cmap/auth/providers';
import { Compressor, CompressorName } from './cmap/wire_protocol/compression';
import { Encrypter } from './encrypter';
import { MongoAPIError, MongoInvalidArgumentError, MongoParseError } from './error';
import {
MongoAPIError,
MongoInvalidArgumentError,
MongoMissingCredentialsError,
MongoParseError
} from './error';
import { Logger, LoggerLevel } from './logger';
import {
DriverInfo,
Expand Down Expand Up @@ -407,6 +412,12 @@ export function parseOptions(
});
}

if (isAws && mongoOptions.credentials.username && !mongoOptions.credentials.password) {
throw new MongoMissingCredentialsError(
`When using ${mongoOptions.credentials.mechanism} password must be set when a username is specified`
);
}

mongoOptions.credentials.validate();

// Check if the only auth related option provided was authSource, if so we can remove credentials
Expand Down
6 changes: 0 additions & 6 deletions test/unit/assorted/auth.spec.test.ts
@@ -1,19 +1,13 @@
import { loadSpecTests } from '../../spec';
import { executeUriValidationTest } from '../../tools/uri_spec_runner';

const SKIP = ['should throw an exception if username and no password (MONGODB-AWS)'];

describe('Auth option spec tests', function () {
const suites = loadSpecTests('auth');

for (const suite of suites) {
describe(suite.name, function () {
for (const test of suite.tests) {
it(`${test.description}`, function () {
if (SKIP.includes(test.description)) {
this.test.skipReason = 'NODE-3986: Fix MONGODB-AWS Spec Test';
this.skip();
}
executeUriValidationTest(test);
});
}
Expand Down