Skip to content

Commit 9aee3fe

Browse files
committed
fix: lb mode error
1 parent 9699ea2 commit 9aee3fe

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

test/integration/mongodb-handshake/mongodb-handshake.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { expect } from 'chai';
22
import * as sinon from 'sinon';
33

4-
import { Connection, LEGACY_HELLO_COMMAND, MongoServerSelectionError } from '../../mongodb';
4+
import {
5+
Connection,
6+
LEGACY_HELLO_COMMAND,
7+
MongoServerError,
8+
MongoServerSelectionError
9+
} from '../../mongodb';
510

611
describe('MongoDB Handshake Node tests', () => {
712
let client;
@@ -29,7 +34,11 @@ describe('MongoDB Handshake Node tests', () => {
2934
it('client fails to connect with an error relating to size', async function () {
3035
client = this.configuration.newClient({ serverSelectionTimeoutMS: 2000 });
3136
const error = await client.connect().catch(error => error);
32-
expect(error).to.be.instanceOf(MongoServerSelectionError);
37+
if (this.configuration.isLoadBalanced) {
38+
expect(error).to.be.instanceOf(MongoServerError);
39+
} else {
40+
expect(error).to.be.instanceOf(MongoServerSelectionError);
41+
}
3342
expect(error).to.match(/client metadata document must be less/);
3443
});
3544
});

test/unit/cmap/handshake/client_metadata.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getFAASEnv, Int32, makeClientMetadata } from '../../../mongodb';
99
const NODE_DRIVER_VERSION = require('../../../../package.json').version;
1010

1111
describe('client metadata module', () => {
12-
describe('determineCloudProvider()', function () {
12+
describe('getFAASEnv()', function () {
1313
const tests: Array<[string, string]> = [
1414
['AWS_EXECUTION_ENV', 'aws.lambda'],
1515
['AWS_LAMBDA_RUNTIME_API', 'aws.lambda'],

0 commit comments

Comments
 (0)