From 41eb46a46f3ed1554afa500ff43c021b8407236a Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Wed, 12 Mar 2025 14:20:49 -0400 Subject: [PATCH 1/2] chore(NODE-6848): reduce flakiness of Client Bulk Write CSOT enabled acknowledged writes when the timeout is reached while iterating the result cursor the bulk write operation times out --- test/integration/crud/client_bulk_write.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/crud/client_bulk_write.test.ts b/test/integration/crud/client_bulk_write.test.ts index fa20d8ed29a..31c28d41175 100644 --- a/test/integration/crud/client_bulk_write.test.ts +++ b/test/integration/crud/client_bulk_write.test.ts @@ -304,7 +304,7 @@ describe('Client Bulk Write', function () { // DRIVERS-3005 - killCursors causes cursor cleanup to extend past timeoutMS. // The amount of time killCursors takes is wildly variable and can take up to almost // 600-700ms sometimes. - expect(end - start).to.be.within(1500, 1500 + 800); + expect(end - start).to.be.within(1498, 1500 + 800); expect(commands.map(({ commandName }) => commandName)).to.have.lengthOf(2); } ); From 5d6cac7c12426c62e00977ab56026da761d2b0d3 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Wed, 12 Mar 2025 15:45:56 -0400 Subject: [PATCH 2/2] chore: use +/- pattern --- test/integration/crud/client_bulk_write.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/integration/crud/client_bulk_write.test.ts b/test/integration/crud/client_bulk_write.test.ts index 31c28d41175..0d1ce58029c 100644 --- a/test/integration/crud/client_bulk_write.test.ts +++ b/test/integration/crud/client_bulk_write.test.ts @@ -289,12 +289,13 @@ describe('Client Bulk Write', function () { } }), async function () { + const timeoutMS = 1500; const models = await makeMultiResponseBatchModelArray(this.configuration); const start = now(); const timeoutError = await client .bulkWrite(models, { verboseResults: true, - timeoutMS: 1500 + timeoutMS }) .catch(e => e); @@ -304,7 +305,7 @@ describe('Client Bulk Write', function () { // DRIVERS-3005 - killCursors causes cursor cleanup to extend past timeoutMS. // The amount of time killCursors takes is wildly variable and can take up to almost // 600-700ms sometimes. - expect(end - start).to.be.within(1498, 1500 + 800); + expect(end - start).to.be.within(timeoutMS - 100, timeoutMS + 800); expect(commands.map(({ commandName }) => commandName)).to.have.lengthOf(2); } );