Skip to content

Commit

Permalink
fix: lb mode error
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Apr 5, 2023
1 parent 70da1d6 commit 871d208
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions test/integration/mongodb-handshake/mongodb-handshake.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { expect } from 'chai';
import * as sinon from 'sinon';

import { Connection, LEGACY_HELLO_COMMAND, MongoServerSelectionError } from '../../mongodb';
import {
Connection,
LEGACY_HELLO_COMMAND,
MongoServerError,
MongoServerSelectionError
} from '../../mongodb';

describe('MongoDB Handshake Node tests', () => {
let client;
Expand Down Expand Up @@ -29,7 +34,11 @@ describe('MongoDB Handshake Node tests', () => {
it('client fails to connect with an error relating to size', async function () {
client = this.configuration.newClient({ serverSelectionTimeoutMS: 2000 });
const error = await client.connect().catch(error => error);
expect(error).to.be.instanceOf(MongoServerSelectionError);
if (this.configuration.isLoadBalanced) {
expect(error).to.be.instanceOf(MongoServerError);
} else {
expect(error).to.be.instanceOf(MongoServerSelectionError);
}
expect(error).to.match(/client metadata document must be less/);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/cmap/handshake/client_metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getFAASEnv, Int32, makeClientMetadata } from '../../../mongodb';
const NODE_DRIVER_VERSION = require('../../../../package.json').version;

describe('client metadata module', () => {
describe('determineCloudProvider()', function () {
describe('getFAASEnv()', function () {
const tests: Array<[string, string]> = [
['AWS_EXECUTION_ENV', 'aws.lambda'],
['AWS_LAMBDA_RUNTIME_API', 'aws.lambda'],
Expand Down

0 comments on commit 871d208

Please sign in to comment.