Skip to content

Commit

Permalink
add catch
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Aug 23, 2024
1 parent 9fad7f3 commit 34a9880
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions test/integration/client-side-operations-timeout/node_csot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { expect } from 'chai';
import * as semver from 'semver';
import * as sinon from 'sinon';

import { type CommandSucceededEvent } from '../../../lib/cmap/command_monitoring_events';
import {
BSON,
type ClientSession,
type Collection,
type CommandFailedEvent,
type CommandStartedEvent,
type CommandSucceededEvent,
Connection,
type Db,
type FindCursor,
Expand Down Expand Up @@ -174,8 +175,8 @@ describe('CSOT driver tests', { requires: { mongodb: '>=4.4' } }, () => {

describe('server-side maxTimeMS errors are transformed', () => {
let client: MongoClient;
let commandsSucceeded;
let commandsFailed;
let commandsSucceeded: CommandSucceededEvent[];
let commandsFailed: CommandFailedEvent[];

beforeEach(async function () {
client = this.configuration.newClient({ timeoutMS: 500_000, monitorCommands: true });
Expand Down Expand Up @@ -341,8 +342,11 @@ describe('CSOT driver tests', { requires: { mongodb: '>=4.4' } }, () => {
};

beforeEach(async function () {
internalClient = this.configuration.newClient(undefined);
await internalClient.db('db').dropCollection('coll');
internalClient = this.configuration.newClient();
await internalClient
.db('db')
.dropCollection('coll')
.catch(() => null);
await internalClient
.db('db')
.collection('coll')
Expand Down Expand Up @@ -444,8 +448,11 @@ describe('CSOT driver tests', { requires: { mongodb: '>=4.4' } }, () => {
};

beforeEach(async function () {
internalClient = this.configuration.newClient(undefined);
await internalClient.db('db').dropCollection('coll');
internalClient = this.configuration.newClient();
await internalClient
.db('db')
.dropCollection('coll')
.catch(() => null);
await internalClient
.db('db')
.collection('coll')
Expand Down

0 comments on commit 34a9880

Please sign in to comment.