Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Oct 10, 2024
1 parent e06c10f commit 24ea3f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function isCSOTTimeoutContextOptions(v: unknown): v is CSOTTimeoutContextOptions

/** @internal */
export abstract class TimeoutContext {
static create(options: Partial<TimeoutContextOptions>): TimeoutContext {
static create(options: TimeoutContextOptions): TimeoutContext {
if (options.session?.timeoutContext != null) return options.session?.timeoutContext;
if (isCSOTTimeoutContextOptions(options)) return new CSOTTimeoutContext(options);
else if (isLegacyTimeoutContextOptions(options)) return new LegacyTimeoutContext(options);
Expand Down
17 changes: 8 additions & 9 deletions test/integration/crud/client_bulk_write.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
type Connection,
type ConnectionPool,
type MongoClient,
MongoError,
MongoOperationTimeoutError,
now,
TimeoutContext
Expand Down Expand Up @@ -58,7 +57,7 @@ describe('Client Bulk Write', function () {
])
.catch(e => e);
const end = now();
expect(timeoutError).to.be.instanceOf(MongoError);
expect(timeoutError).to.be.instanceOf(MongoOperationTimeoutError);
expect(end - start).to.be.within(300 - 100, 300 + 100);
});
});
Expand Down Expand Up @@ -91,7 +90,7 @@ describe('Client Bulk Write', function () {
)
.catch(e => e);
const end = now();
expect(timeoutError).to.be.instanceOf(MongoError);
expect(timeoutError).to.be.instanceOf(MongoOperationTimeoutError);
expect(end - start).to.be.within(300 - 100, 300 + 100);
});
});
Expand Down Expand Up @@ -124,7 +123,7 @@ describe('Client Bulk Write', function () {
)
.catch(e => e);
const end = now();
expect(timeoutError).to.be.instanceOf(MongoError);
expect(timeoutError).to.be.instanceOf(MongoOperationTimeoutError);
expect(end - start).to.be.within(300 - 100, 300 + 100);
});
});
Expand Down Expand Up @@ -183,7 +182,7 @@ describe('Client Bulk Write', function () {

await setTimeout(250);

expect(await timeoutError).to.be.instanceOf(MongoError);
expect(await timeoutError).to.be.instanceOf(MongoOperationTimeoutError);
expect(end - start).to.be.within(200 - 100, 200 + 100);
});

Expand Down Expand Up @@ -222,7 +221,7 @@ describe('Client Bulk Write', function () {

await setTimeout(210);

expect(await timeoutError).to.be.instanceOf(MongoError);
expect(await timeoutError).to.be.instanceOf(MongoOperationTimeoutError);
expect(end - start).to.be.within(400 - 100, 400 + 100);
}
);
Expand Down Expand Up @@ -258,7 +257,7 @@ describe('Client Bulk Write', function () {
)
.catch(e => e);
const end = now();
expect(timeoutError).to.be.instanceOf(MongoError);
expect(timeoutError).to.be.instanceOf(MongoOperationTimeoutError);
expect(end - start).to.be.within(300 - 100, 300 + 100);
});
});
Expand Down Expand Up @@ -289,7 +288,7 @@ describe('Client Bulk Write', function () {
.catch(e => e);

const end = now();
expect(timeoutError).to.be.instanceOf(MongoError);
expect(timeoutError).to.be.instanceOf(MongoOperationTimeoutError);

// DRIVERS-3005 - killCursors causes cursor cleanup to extend past timeoutMS.
expect(end - start).to.be.within(2000 - 100, 2000 + 100);
Expand Down Expand Up @@ -372,7 +371,7 @@ describe('Client Bulk Write', function () {
.catch(e => e);

const end = now();
expect(timeoutError).to.be.instanceOf(MongoError);
expect(timeoutError).to.be.instanceOf(MongoOperationTimeoutError);
expect(end - start).to.be.within(2000 - 100, 2000 + 100);
expect(commands.length, 'Test must execute two batches.').to.equal(2);
}
Expand Down

0 comments on commit 24ea3f2

Please sign in to comment.